<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE BangPatterns #-}</span><span class="hs-cpp">
#if defined(__GLASGOW_HASKELL__)
</span><span class="hs-pragma">{-# LANGUAGE Trustworthy #-}</span><span class="hs-cpp">
#endif
</span><span class="hs-pragma">{-# OPTIONS_HADDOCK not-home #-}</span><span class="hs-cpp">

#include &quot;containers.h&quot;
</span><span>
</span><span id="line-10"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- Module      :  Data.Map.Strict.Internal</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- Copyright   :  (c) Daan Leijen 2002</span><span>
</span><span id="line-14"></span><span class="hs-comment">--                (c) Andriy Palamarchuk 2008</span><span>
</span><span id="line-15"></span><span class="hs-comment">-- License     :  BSD-style</span><span>
</span><span id="line-16"></span><span class="hs-comment">-- Maintainer  :  libraries@haskell.org</span><span>
</span><span id="line-17"></span><span class="hs-comment">-- Portability :  portable</span><span>
</span><span id="line-18"></span><span class="hs-comment">--</span><span>
</span><span id="line-19"></span><span class="hs-comment">-- = WARNING</span><span>
</span><span id="line-20"></span><span class="hs-comment">--</span><span>
</span><span id="line-21"></span><span class="hs-comment">-- This module is considered __internal__.</span><span>
</span><span id="line-22"></span><span class="hs-comment">--</span><span>
</span><span id="line-23"></span><span class="hs-comment">-- The Package Versioning Policy __does not apply__.</span><span>
</span><span id="line-24"></span><span class="hs-comment">--</span><span>
</span><span id="line-25"></span><span class="hs-comment">-- The contents of this module may change __in any way whatsoever__</span><span>
</span><span id="line-26"></span><span class="hs-comment">-- and __without any warning__ between minor versions of this package.</span><span>
</span><span id="line-27"></span><span class="hs-comment">--</span><span>
</span><span id="line-28"></span><span class="hs-comment">-- Authors importing this module are expected to track development</span><span>
</span><span id="line-29"></span><span class="hs-comment">-- closely.</span><span>
</span><span id="line-30"></span><span class="hs-comment">--</span><span>
</span><span id="line-31"></span><span class="hs-comment">-- = Description</span><span>
</span><span id="line-32"></span><span class="hs-comment">--</span><span>
</span><span id="line-33"></span><span class="hs-comment">-- An efficient implementation of ordered maps from keys to values</span><span>
</span><span id="line-34"></span><span class="hs-comment">-- (dictionaries).</span><span>
</span><span id="line-35"></span><span class="hs-comment">--</span><span>
</span><span id="line-36"></span><span class="hs-comment">-- API of this module is strict in both the keys and the values.</span><span>
</span><span id="line-37"></span><span class="hs-comment">-- If you need value-lazy maps, use &quot;Data.Map.Lazy&quot; instead.</span><span>
</span><span id="line-38"></span><span class="hs-comment">-- The 'Map' type is shared between the lazy and strict modules,</span><span>
</span><span id="line-39"></span><span class="hs-comment">-- meaning that the same 'Map' value can be passed to functions in</span><span>
</span><span id="line-40"></span><span class="hs-comment">-- both modules (although that is rarely needed).</span><span>
</span><span id="line-41"></span><span class="hs-comment">--</span><span>
</span><span id="line-42"></span><span class="hs-comment">-- These modules are intended to be imported qualified, to avoid name</span><span>
</span><span id="line-43"></span><span class="hs-comment">-- clashes with Prelude functions, e.g.</span><span>
</span><span id="line-44"></span><span class="hs-comment">--</span><span>
</span><span id="line-45"></span><span class="hs-comment">-- &gt;  import qualified Data.Map.Strict as Map</span><span>
</span><span id="line-46"></span><span class="hs-comment">--</span><span>
</span><span id="line-47"></span><span class="hs-comment">-- The implementation of 'Map' is based on /size balanced/ binary trees (or</span><span>
</span><span id="line-48"></span><span class="hs-comment">-- trees of /bounded balance/) as described by:</span><span>
</span><span id="line-49"></span><span class="hs-comment">--</span><span>
</span><span id="line-50"></span><span class="hs-comment">--    * Stephen Adams, \&quot;/Efficient sets: a balancing act/\&quot;,</span><span>
</span><span id="line-51"></span><span class="hs-comment">--     Journal of Functional Programming 3(4):553-562, October 1993,</span><span>
</span><span id="line-52"></span><span class="hs-comment">--     &lt;http://www.swiss.ai.mit.edu/~adams/BB/&gt;.</span><span>
</span><span id="line-53"></span><span class="hs-comment">--    * J. Nievergelt and E.M. Reingold,</span><span>
</span><span id="line-54"></span><span class="hs-comment">--      \&quot;/Binary search trees of bounded balance/\&quot;,</span><span>
</span><span id="line-55"></span><span class="hs-comment">--      SIAM journal of computing 2(1), March 1973.</span><span>
</span><span id="line-56"></span><span class="hs-comment">--</span><span>
</span><span id="line-57"></span><span class="hs-comment">--  Bounds for 'union', 'intersection', and 'difference' are as given</span><span>
</span><span id="line-58"></span><span class="hs-comment">--  by</span><span>
</span><span id="line-59"></span><span class="hs-comment">--</span><span>
</span><span id="line-60"></span><span class="hs-comment">--    * Guy Blelloch, Daniel Ferizovic, and Yihan Sun,</span><span>
</span><span id="line-61"></span><span class="hs-comment">--      \&quot;/Just Join for Parallel Ordered Sets/\&quot;,</span><span>
</span><span id="line-62"></span><span class="hs-comment">--      &lt;https://arxiv.org/abs/1602.02120v3&gt;.</span><span>
</span><span id="line-63"></span><span class="hs-comment">--</span><span>
</span><span id="line-64"></span><span class="hs-comment">-- Note that the implementation is /left-biased/ -- the elements of a</span><span>
</span><span id="line-65"></span><span class="hs-comment">-- first argument are always preferred to the second, for example in</span><span>
</span><span id="line-66"></span><span class="hs-comment">-- 'union' or 'insert'.</span><span>
</span><span id="line-67"></span><span class="hs-comment">--</span><span>
</span><span id="line-68"></span><span class="hs-comment">-- /Warning/: The size of the map must not exceed @maxBound::Int@. Violation of</span><span>
</span><span id="line-69"></span><span class="hs-comment">-- this condition is not detected and if the size limit is exceeded, its</span><span>
</span><span id="line-70"></span><span class="hs-comment">-- behaviour is undefined.</span><span>
</span><span id="line-71"></span><span class="hs-comment">--</span><span>
</span><span id="line-72"></span><span class="hs-comment">-- Operation comments contain the operation time complexity in</span><span>
</span><span id="line-73"></span><span class="hs-comment">-- the Big-O notation (&lt;http://en.wikipedia.org/wiki/Big_O_notation&gt;).</span><span>
</span><span id="line-74"></span><span class="hs-comment">--</span><span>
</span><span id="line-75"></span><span class="hs-comment">-- Be aware that the 'Functor', 'Traversable' and 'Data.Data.Data' instances</span><span>
</span><span id="line-76"></span><span class="hs-comment">-- are the same as for the &quot;Data.Map.Lazy&quot; module, so if they are used</span><span>
</span><span id="line-77"></span><span class="hs-comment">-- on strict maps, the resulting maps will be lazy.</span><span>
</span><span id="line-78"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-79"></span><span>
</span><span id="line-80"></span><span class="hs-comment">-- See the notes at the beginning of Data.Map.Internal.</span><span>
</span><span id="line-81"></span><span>
</span><span id="line-82"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Data.Map.Strict.Internal</span><span>
</span><span id="line-83"></span><span>    </span><span class="hs-special">(</span><span>
</span><span id="line-84"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Strictness properties</span></span><span>
</span><span id="line-85"></span><span>    </span><span class="annot"><span class="hs-comment">-- $strictness</span></span><span>
</span><span id="line-86"></span><span>
</span><span id="line-87"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Map type</span></span><span>
</span><span id="line-88"></span><span>    </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier">Map</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>          </span><span class="hs-comment">-- instance Eq,Show,Read</span><span>
</span><span id="line-89"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Size"><span class="hs-identifier">L.Size</span></a></span><span>
</span><span id="line-90"></span><span>
</span><span id="line-91"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Operators</span></span><span>
</span><span id="line-92"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#%21"><span class="hs-operator">(!)</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#%21%3F"><span class="hs-operator">(!?)</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#%5C%5C"><span class="hs-operator">(\\)</span></a></span><span>
</span><span id="line-93"></span><span>
</span><span id="line-94"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Query</span></span><span>
</span><span id="line-95"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#null"><span class="hs-identifier">null</span></a></span><span>
</span><span id="line-96"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#size"><span class="hs-identifier">size</span></a></span><span>
</span><span id="line-97"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#member"><span class="hs-identifier">member</span></a></span><span>
</span><span id="line-98"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#notMember"><span class="hs-identifier">notMember</span></a></span><span>
</span><span id="line-99"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#lookup"><span class="hs-identifier">lookup</span></a></span><span>
</span><span id="line-100"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#findWithDefault"><span class="hs-identifier">findWithDefault</span></a></span><span>
</span><span id="line-101"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#lookupLT"><span class="hs-identifier">lookupLT</span></a></span><span>
</span><span id="line-102"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#lookupGT"><span class="hs-identifier">lookupGT</span></a></span><span>
</span><span id="line-103"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#lookupLE"><span class="hs-identifier">lookupLE</span></a></span><span>
</span><span id="line-104"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#lookupGE"><span class="hs-identifier">lookupGE</span></a></span><span>
</span><span id="line-105"></span><span>
</span><span id="line-106"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Construction</span></span><span>
</span><span id="line-107"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#empty"><span class="hs-identifier">empty</span></a></span><span>
</span><span id="line-108"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#singleton"><span class="hs-identifier">singleton</span></a></span><span>
</span><span id="line-109"></span><span>
</span><span id="line-110"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Insertion</span></span><span>
</span><span id="line-111"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#insert"><span class="hs-identifier">insert</span></a></span><span>
</span><span id="line-112"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#insertWith"><span class="hs-identifier">insertWith</span></a></span><span>
</span><span id="line-113"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#insertWithKey"><span class="hs-identifier">insertWithKey</span></a></span><span>
</span><span id="line-114"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#insertLookupWithKey"><span class="hs-identifier">insertLookupWithKey</span></a></span><span>
</span><span id="line-115"></span><span>
</span><span id="line-116"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Delete\/Update</span></span><span>
</span><span id="line-117"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#delete"><span class="hs-identifier">delete</span></a></span><span>
</span><span id="line-118"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#adjust"><span class="hs-identifier">adjust</span></a></span><span>
</span><span id="line-119"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#adjustWithKey"><span class="hs-identifier">adjustWithKey</span></a></span><span>
</span><span id="line-120"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#update"><span class="hs-identifier">update</span></a></span><span>
</span><span id="line-121"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#updateWithKey"><span class="hs-identifier">updateWithKey</span></a></span><span>
</span><span id="line-122"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#updateLookupWithKey"><span class="hs-identifier">updateLookupWithKey</span></a></span><span>
</span><span id="line-123"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#alter"><span class="hs-identifier">alter</span></a></span><span>
</span><span id="line-124"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#alterF"><span class="hs-identifier">alterF</span></a></span><span>
</span><span id="line-125"></span><span>
</span><span id="line-126"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Combine</span></span><span>
</span><span id="line-127"></span><span>
</span><span id="line-128"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Union</span></span><span>
</span><span id="line-129"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#union"><span class="hs-identifier">union</span></a></span><span>
</span><span id="line-130"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#unionWith"><span class="hs-identifier">unionWith</span></a></span><span>
</span><span id="line-131"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#unionWithKey"><span class="hs-identifier">unionWithKey</span></a></span><span>
</span><span id="line-132"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#unions"><span class="hs-identifier">unions</span></a></span><span>
</span><span id="line-133"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#unionsWith"><span class="hs-identifier">unionsWith</span></a></span><span>
</span><span id="line-134"></span><span>
</span><span id="line-135"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Difference</span></span><span>
</span><span id="line-136"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#difference"><span class="hs-identifier">difference</span></a></span><span>
</span><span id="line-137"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#differenceWith"><span class="hs-identifier">differenceWith</span></a></span><span>
</span><span id="line-138"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#differenceWithKey"><span class="hs-identifier">differenceWithKey</span></a></span><span>
</span><span id="line-139"></span><span>
</span><span id="line-140"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Intersection</span></span><span>
</span><span id="line-141"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#intersection"><span class="hs-identifier">intersection</span></a></span><span>
</span><span id="line-142"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#intersectionWith"><span class="hs-identifier">intersectionWith</span></a></span><span>
</span><span id="line-143"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#intersectionWithKey"><span class="hs-identifier">intersectionWithKey</span></a></span><span>
</span><span id="line-144"></span><span>
</span><span id="line-145"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Disjoint</span></span><span>
</span><span id="line-146"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#disjoint"><span class="hs-identifier">disjoint</span></a></span><span>
</span><span id="line-147"></span><span>
</span><span id="line-148"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Compose</span></span><span>
</span><span id="line-149"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#compose"><span class="hs-identifier">compose</span></a></span><span>
</span><span id="line-150"></span><span>
</span><span id="line-151"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** General combining function</span></span><span>
</span><span id="line-152"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#SimpleWhenMissing"><span class="hs-identifier">SimpleWhenMissing</span></a></span><span>
</span><span id="line-153"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#SimpleWhenMatched"><span class="hs-identifier">SimpleWhenMatched</span></a></span><span>
</span><span id="line-154"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#merge"><span class="hs-identifier">merge</span></a></span><span>
</span><span id="line-155"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#runWhenMatched"><span class="hs-identifier">runWhenMatched</span></a></span><span>
</span><span id="line-156"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#runWhenMissing"><span class="hs-identifier">runWhenMissing</span></a></span><span>
</span><span id="line-157"></span><span>
</span><span id="line-158"></span><span>    </span><span class="annot"><span class="hs-comment">-- *** @WhenMatched@ tactics</span></span><span>
</span><span id="line-159"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#zipWithMaybeMatched"><span class="hs-identifier">zipWithMaybeMatched</span></a></span><span>
</span><span id="line-160"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#zipWithMatched"><span class="hs-identifier">zipWithMatched</span></a></span><span>
</span><span id="line-161"></span><span>
</span><span id="line-162"></span><span>    </span><span class="annot"><span class="hs-comment">-- *** @WhenMissing@ tactics</span></span><span>
</span><span id="line-163"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapMaybeMissing"><span class="hs-identifier">mapMaybeMissing</span></a></span><span>
</span><span id="line-164"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#dropMissing"><span class="hs-identifier">dropMissing</span></a></span><span>
</span><span id="line-165"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#preserveMissing"><span class="hs-identifier">preserveMissing</span></a></span><span>
</span><span id="line-166"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#preserveMissing%27"><span class="hs-identifier">preserveMissing'</span></a></span><span>
</span><span id="line-167"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapMissing"><span class="hs-identifier">mapMissing</span></a></span><span>
</span><span id="line-168"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#filterMissing"><span class="hs-identifier">filterMissing</span></a></span><span>
</span><span id="line-169"></span><span>
</span><span id="line-170"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Applicative general combining function</span></span><span>
</span><span id="line-171"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#WhenMissing"><span class="hs-identifier">WhenMissing</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-172"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#WhenMatched"><span class="hs-identifier">WhenMatched</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-173"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#mergeA"><span class="hs-identifier">mergeA</span></a></span><span>
</span><span id="line-174"></span><span>
</span><span id="line-175"></span><span>    </span><span class="annot"><span class="hs-comment">-- *** @WhenMatched@ tactics</span></span><span>
</span><span id="line-176"></span><span>    </span><span class="hs-comment">-- | The tactics described for 'merge' work for</span><span>
</span><span id="line-177"></span><span>    </span><span class="hs-comment">-- 'mergeA' as well. Furthermore, the following</span><span>
</span><span id="line-178"></span><span>    </span><span class="hs-comment">-- are available.</span><span>
</span><span id="line-179"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#zipWithMaybeAMatched"><span class="hs-identifier">zipWithMaybeAMatched</span></a></span><span>
</span><span id="line-180"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#zipWithAMatched"><span class="hs-identifier">zipWithAMatched</span></a></span><span>
</span><span id="line-181"></span><span>
</span><span id="line-182"></span><span>    </span><span class="annot"><span class="hs-comment">-- *** @WhenMissing@ tactics</span></span><span>
</span><span id="line-183"></span><span>    </span><span class="hs-comment">-- | The tactics described for 'merge' work for</span><span>
</span><span id="line-184"></span><span>    </span><span class="hs-comment">-- 'mergeA' as well. Furthermore, the following</span><span>
</span><span id="line-185"></span><span>    </span><span class="hs-comment">-- are available.</span><span>
</span><span id="line-186"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#traverseMaybeMissing"><span class="hs-identifier">traverseMaybeMissing</span></a></span><span>
</span><span id="line-187"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#traverseMissing"><span class="hs-identifier">traverseMissing</span></a></span><span>
</span><span id="line-188"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#filterAMissing"><span class="hs-identifier">filterAMissing</span></a></span><span>
</span><span id="line-189"></span><span>
</span><span id="line-190"></span><span>    </span><span class="annot"><span class="hs-comment">-- *** Covariant maps for tactics</span></span><span>
</span><span id="line-191"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapWhenMissing"><span class="hs-identifier">mapWhenMissing</span></a></span><span>
</span><span id="line-192"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapWhenMatched"><span class="hs-identifier">mapWhenMatched</span></a></span><span>
</span><span id="line-193"></span><span>
</span><span id="line-194"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Deprecated general combining function</span></span><span>
</span><span id="line-195"></span><span>
</span><span id="line-196"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mergeWithKey"><span class="hs-identifier">mergeWithKey</span></a></span><span>
</span><span id="line-197"></span><span>
</span><span id="line-198"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Traversal</span></span><span>
</span><span id="line-199"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Map</span></span><span>
</span><span id="line-200"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#map"><span class="hs-identifier">map</span></a></span><span>
</span><span id="line-201"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapWithKey"><span class="hs-identifier">mapWithKey</span></a></span><span>
</span><span id="line-202"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#traverseWithKey"><span class="hs-identifier">traverseWithKey</span></a></span><span>
</span><span id="line-203"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#traverseMaybeWithKey"><span class="hs-identifier">traverseMaybeWithKey</span></a></span><span>
</span><span id="line-204"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapAccum"><span class="hs-identifier">mapAccum</span></a></span><span>
</span><span id="line-205"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapAccumWithKey"><span class="hs-identifier">mapAccumWithKey</span></a></span><span>
</span><span id="line-206"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapAccumRWithKey"><span class="hs-identifier">mapAccumRWithKey</span></a></span><span>
</span><span id="line-207"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#mapKeys"><span class="hs-identifier">mapKeys</span></a></span><span>
</span><span id="line-208"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapKeysWith"><span class="hs-identifier">mapKeysWith</span></a></span><span>
</span><span id="line-209"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#mapKeysMonotonic"><span class="hs-identifier">mapKeysMonotonic</span></a></span><span>
</span><span id="line-210"></span><span>
</span><span id="line-211"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Folds</span></span><span>
</span><span id="line-212"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#foldr"><span class="hs-identifier">foldr</span></a></span><span>
</span><span id="line-213"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#foldl"><span class="hs-identifier">foldl</span></a></span><span>
</span><span id="line-214"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#foldrWithKey"><span class="hs-identifier">foldrWithKey</span></a></span><span>
</span><span id="line-215"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#foldlWithKey"><span class="hs-identifier">foldlWithKey</span></a></span><span>
</span><span id="line-216"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#foldMapWithKey"><span class="hs-identifier">foldMapWithKey</span></a></span><span>
</span><span id="line-217"></span><span>
</span><span id="line-218"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Strict folds</span></span><span>
</span><span id="line-219"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#foldr%27"><span class="hs-identifier">foldr'</span></a></span><span>
</span><span id="line-220"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#foldl%27"><span class="hs-identifier">foldl'</span></a></span><span>
</span><span id="line-221"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#foldrWithKey%27"><span class="hs-identifier">foldrWithKey'</span></a></span><span>
</span><span id="line-222"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#foldlWithKey%27"><span class="hs-identifier">foldlWithKey'</span></a></span><span>
</span><span id="line-223"></span><span>
</span><span id="line-224"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Conversion</span></span><span>
</span><span id="line-225"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#elems"><span class="hs-identifier">elems</span></a></span><span>
</span><span id="line-226"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#keys"><span class="hs-identifier">keys</span></a></span><span>
</span><span id="line-227"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#assocs"><span class="hs-identifier">assocs</span></a></span><span>
</span><span id="line-228"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#keysSet"><span class="hs-identifier">keysSet</span></a></span><span>
</span><span id="line-229"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#fromSet"><span class="hs-identifier">fromSet</span></a></span><span>
</span><span id="line-230"></span><span>
</span><span id="line-231"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Lists</span></span><span>
</span><span id="line-232"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#toList"><span class="hs-identifier">toList</span></a></span><span>
</span><span id="line-233"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#fromList"><span class="hs-identifier">fromList</span></a></span><span>
</span><span id="line-234"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#fromListWith"><span class="hs-identifier">fromListWith</span></a></span><span>
</span><span id="line-235"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#fromListWithKey"><span class="hs-identifier">fromListWithKey</span></a></span><span>
</span><span id="line-236"></span><span>
</span><span id="line-237"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Ordered lists</span></span><span>
</span><span id="line-238"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#toAscList"><span class="hs-identifier">toAscList</span></a></span><span>
</span><span id="line-239"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#toDescList"><span class="hs-identifier">toDescList</span></a></span><span>
</span><span id="line-240"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#fromAscList"><span class="hs-identifier">fromAscList</span></a></span><span>
</span><span id="line-241"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#fromAscListWith"><span class="hs-identifier">fromAscListWith</span></a></span><span>
</span><span id="line-242"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#fromAscListWithKey"><span class="hs-identifier">fromAscListWithKey</span></a></span><span>
</span><span id="line-243"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#fromDistinctAscList"><span class="hs-identifier">fromDistinctAscList</span></a></span><span>
</span><span id="line-244"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#fromDescList"><span class="hs-identifier">fromDescList</span></a></span><span>
</span><span id="line-245"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#fromDescListWith"><span class="hs-identifier">fromDescListWith</span></a></span><span>
</span><span id="line-246"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#fromDescListWithKey"><span class="hs-identifier">fromDescListWithKey</span></a></span><span>
</span><span id="line-247"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#fromDistinctDescList"><span class="hs-identifier">fromDistinctDescList</span></a></span><span>
</span><span id="line-248"></span><span>
</span><span id="line-249"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Filter</span></span><span>
</span><span id="line-250"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#filter"><span class="hs-identifier">filter</span></a></span><span>
</span><span id="line-251"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#filterWithKey"><span class="hs-identifier">filterWithKey</span></a></span><span>
</span><span id="line-252"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#restrictKeys"><span class="hs-identifier">restrictKeys</span></a></span><span>
</span><span id="line-253"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#withoutKeys"><span class="hs-identifier">withoutKeys</span></a></span><span>
</span><span id="line-254"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#partition"><span class="hs-identifier">partition</span></a></span><span>
</span><span id="line-255"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#partitionWithKey"><span class="hs-identifier">partitionWithKey</span></a></span><span>
</span><span id="line-256"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#takeWhileAntitone"><span class="hs-identifier">takeWhileAntitone</span></a></span><span>
</span><span id="line-257"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#dropWhileAntitone"><span class="hs-identifier">dropWhileAntitone</span></a></span><span>
</span><span id="line-258"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#spanAntitone"><span class="hs-identifier">spanAntitone</span></a></span><span>
</span><span id="line-259"></span><span>
</span><span id="line-260"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapMaybe"><span class="hs-identifier">mapMaybe</span></a></span><span>
</span><span id="line-261"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapMaybeWithKey"><span class="hs-identifier">mapMaybeWithKey</span></a></span><span>
</span><span id="line-262"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapEither"><span class="hs-identifier">mapEither</span></a></span><span>
</span><span id="line-263"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapEitherWithKey"><span class="hs-identifier">mapEitherWithKey</span></a></span><span>
</span><span id="line-264"></span><span>
</span><span id="line-265"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#split"><span class="hs-identifier">split</span></a></span><span>
</span><span id="line-266"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#splitLookup"><span class="hs-identifier">splitLookup</span></a></span><span>
</span><span id="line-267"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#splitRoot"><span class="hs-identifier">splitRoot</span></a></span><span>
</span><span id="line-268"></span><span>
</span><span id="line-269"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Submap</span></span><span>
</span><span id="line-270"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#isSubmapOf"><span class="hs-identifier">isSubmapOf</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#isSubmapOfBy"><span class="hs-identifier">isSubmapOfBy</span></a></span><span>
</span><span id="line-271"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#isProperSubmapOf"><span class="hs-identifier">isProperSubmapOf</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#isProperSubmapOfBy"><span class="hs-identifier">isProperSubmapOfBy</span></a></span><span>
</span><span id="line-272"></span><span>
</span><span id="line-273"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Indexed</span></span><span>
</span><span id="line-274"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#lookupIndex"><span class="hs-identifier">lookupIndex</span></a></span><span>
</span><span id="line-275"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#findIndex"><span class="hs-identifier">findIndex</span></a></span><span>
</span><span id="line-276"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#elemAt"><span class="hs-identifier">elemAt</span></a></span><span>
</span><span id="line-277"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#updateAt"><span class="hs-identifier">updateAt</span></a></span><span>
</span><span id="line-278"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#deleteAt"><span class="hs-identifier">deleteAt</span></a></span><span>
</span><span id="line-279"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#take"><span class="hs-identifier">take</span></a></span><span>
</span><span id="line-280"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#drop"><span class="hs-identifier">drop</span></a></span><span>
</span><span id="line-281"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#splitAt"><span class="hs-identifier">splitAt</span></a></span><span>
</span><span id="line-282"></span><span>
</span><span id="line-283"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Min\/Max</span></span><span>
</span><span id="line-284"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#lookupMin"><span class="hs-identifier">lookupMin</span></a></span><span>
</span><span id="line-285"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#lookupMax"><span class="hs-identifier">lookupMax</span></a></span><span>
</span><span id="line-286"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#findMin"><span class="hs-identifier">findMin</span></a></span><span>
</span><span id="line-287"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#findMax"><span class="hs-identifier">findMax</span></a></span><span>
</span><span id="line-288"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#deleteMin"><span class="hs-identifier">deleteMin</span></a></span><span>
</span><span id="line-289"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#deleteMax"><span class="hs-identifier">deleteMax</span></a></span><span>
</span><span id="line-290"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#deleteFindMin"><span class="hs-identifier">deleteFindMin</span></a></span><span>
</span><span id="line-291"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#deleteFindMax"><span class="hs-identifier">deleteFindMax</span></a></span><span>
</span><span id="line-292"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#updateMin"><span class="hs-identifier">updateMin</span></a></span><span>
</span><span id="line-293"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#updateMax"><span class="hs-identifier">updateMax</span></a></span><span>
</span><span id="line-294"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#updateMinWithKey"><span class="hs-identifier">updateMinWithKey</span></a></span><span>
</span><span id="line-295"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#updateMaxWithKey"><span class="hs-identifier">updateMaxWithKey</span></a></span><span>
</span><span id="line-296"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#minView"><span class="hs-identifier">minView</span></a></span><span>
</span><span id="line-297"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#maxView"><span class="hs-identifier">maxView</span></a></span><span>
</span><span id="line-298"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#minViewWithKey"><span class="hs-identifier">minViewWithKey</span></a></span><span>
</span><span id="line-299"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#maxViewWithKey"><span class="hs-identifier">maxViewWithKey</span></a></span><span>
</span><span id="line-300"></span><span>
</span><span id="line-301"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Debugging</span></span><span class="hs-cpp">
#if defined(__GLASGOW_HASKELL__)
</span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.DeprecatedShowTree.html#showTree"><span class="hs-identifier">showTree</span></a></span><span>
</span><span id="line-304"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.DeprecatedShowTree.html#showTreeWith"><span class="hs-identifier">showTreeWith</span></a></span><span class="hs-cpp">
#endif
</span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.Debug.html#valid"><span class="hs-identifier">valid</span></a></span><span>
</span><span id="line-307"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-308"></span><span>
</span><span id="line-309"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Prelude.html#"><span class="hs-identifier">Prelude</span></a></span><span> </span><span class="hs-keyword">hiding</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.List.html#lookup"><span class="hs-identifier">lookup</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier">map</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier">filter</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier">foldr</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldl"><span class="hs-identifier">foldl</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier">null</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#take"><span class="hs-identifier">take</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#drop"><span class="hs-identifier">drop</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../base/src/GHC.List.html#splitAt"><span class="hs-identifier">splitAt</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-310"></span><span>
</span><span id="line-311"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Map.Internal.html"><span class="hs-identifier">Data.Map.Internal</span></a></span><span>
</span><span id="line-312"></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier">Map</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-313"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#AreWeStrict"><span class="hs-identifier">AreWeStrict</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-314"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#WhenMissing"><span class="hs-identifier">WhenMissing</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-315"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#WhenMatched"><span class="hs-identifier">WhenMatched</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-316"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#runWhenMatched"><span class="hs-identifier">runWhenMatched</span></a></span><span>
</span><span id="line-317"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#runWhenMissing"><span class="hs-identifier">runWhenMissing</span></a></span><span>
</span><span id="line-318"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#SimpleWhenMissing"><span class="hs-identifier">SimpleWhenMissing</span></a></span><span>
</span><span id="line-319"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#SimpleWhenMatched"><span class="hs-identifier">SimpleWhenMatched</span></a></span><span>
</span><span id="line-320"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#preserveMissing"><span class="hs-identifier">preserveMissing</span></a></span><span>
</span><span id="line-321"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#preserveMissing%27"><span class="hs-identifier">preserveMissing'</span></a></span><span>
</span><span id="line-322"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#dropMissing"><span class="hs-identifier">dropMissing</span></a></span><span>
</span><span id="line-323"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#filterMissing"><span class="hs-identifier">filterMissing</span></a></span><span>
</span><span id="line-324"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#filterAMissing"><span class="hs-identifier">filterAMissing</span></a></span><span>
</span><span id="line-325"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#merge"><span class="hs-identifier">merge</span></a></span><span>
</span><span id="line-326"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#mergeA"><span class="hs-identifier">mergeA</span></a></span><span>
</span><span id="line-327"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#%21"><span class="hs-operator">(!)</span></a></span><span>
</span><span id="line-328"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#%21%3F"><span class="hs-operator">(!?)</span></a></span><span>
</span><span id="line-329"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#%5C%5C"><span class="hs-operator">(\\)</span></a></span><span>
</span><span id="line-330"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#assocs"><span class="hs-identifier">assocs</span></a></span><span>
</span><span id="line-331"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#atKeyImpl"><span class="hs-identifier">atKeyImpl</span></a></span><span class="hs-cpp">
#if MIN_VERSION_base(4,8,0)
</span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#atKeyPlain"><span class="hs-identifier">atKeyPlain</span></a></span><span class="hs-cpp">
#endif
</span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#balance"><span class="hs-identifier">balance</span></a></span><span>
</span><span id="line-336"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#balanceL"><span class="hs-identifier">balanceL</span></a></span><span>
</span><span id="line-337"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#balanceR"><span class="hs-identifier">balanceR</span></a></span><span>
</span><span id="line-338"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#compose"><span class="hs-identifier">compose</span></a></span><span>
</span><span id="line-339"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#elemAt"><span class="hs-identifier">elemAt</span></a></span><span>
</span><span id="line-340"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#elems"><span class="hs-identifier">elems</span></a></span><span>
</span><span id="line-341"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#empty"><span class="hs-identifier">empty</span></a></span><span>
</span><span id="line-342"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#delete"><span class="hs-identifier">delete</span></a></span><span>
</span><span id="line-343"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#deleteAt"><span class="hs-identifier">deleteAt</span></a></span><span>
</span><span id="line-344"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#deleteFindMax"><span class="hs-identifier">deleteFindMax</span></a></span><span>
</span><span id="line-345"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#deleteFindMin"><span class="hs-identifier">deleteFindMin</span></a></span><span>
</span><span id="line-346"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#deleteMin"><span class="hs-identifier">deleteMin</span></a></span><span>
</span><span id="line-347"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#deleteMax"><span class="hs-identifier">deleteMax</span></a></span><span>
</span><span id="line-348"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#difference"><span class="hs-identifier">difference</span></a></span><span>
</span><span id="line-349"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#disjoint"><span class="hs-identifier">disjoint</span></a></span><span>
</span><span id="line-350"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#drop"><span class="hs-identifier">drop</span></a></span><span>
</span><span id="line-351"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#dropWhileAntitone"><span class="hs-identifier">dropWhileAntitone</span></a></span><span>
</span><span id="line-352"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#filter"><span class="hs-identifier">filter</span></a></span><span>
</span><span id="line-353"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#filterWithKey"><span class="hs-identifier">filterWithKey</span></a></span><span>
</span><span id="line-354"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#findIndex"><span class="hs-identifier">findIndex</span></a></span><span>
</span><span id="line-355"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#findMax"><span class="hs-identifier">findMax</span></a></span><span>
</span><span id="line-356"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#findMin"><span class="hs-identifier">findMin</span></a></span><span>
</span><span id="line-357"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#foldl"><span class="hs-identifier">foldl</span></a></span><span>
</span><span id="line-358"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#foldl%27"><span class="hs-identifier">foldl'</span></a></span><span>
</span><span id="line-359"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#foldlWithKey"><span class="hs-identifier">foldlWithKey</span></a></span><span>
</span><span id="line-360"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#foldlWithKey%27"><span class="hs-identifier">foldlWithKey'</span></a></span><span>
</span><span id="line-361"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#foldMapWithKey"><span class="hs-identifier">foldMapWithKey</span></a></span><span>
</span><span id="line-362"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#foldr"><span class="hs-identifier">foldr</span></a></span><span>
</span><span id="line-363"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#foldr%27"><span class="hs-identifier">foldr'</span></a></span><span>
</span><span id="line-364"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#foldrWithKey"><span class="hs-identifier">foldrWithKey</span></a></span><span>
</span><span id="line-365"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#foldrWithKey%27"><span class="hs-identifier">foldrWithKey'</span></a></span><span>
</span><span id="line-366"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#glue"><span class="hs-identifier">glue</span></a></span><span>
</span><span id="line-367"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#insertMax"><span class="hs-identifier">insertMax</span></a></span><span>
</span><span id="line-368"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#intersection"><span class="hs-identifier">intersection</span></a></span><span>
</span><span id="line-369"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#isProperSubmapOf"><span class="hs-identifier">isProperSubmapOf</span></a></span><span>
</span><span id="line-370"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#isProperSubmapOfBy"><span class="hs-identifier">isProperSubmapOfBy</span></a></span><span>
</span><span id="line-371"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#isSubmapOf"><span class="hs-identifier">isSubmapOf</span></a></span><span>
</span><span id="line-372"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#isSubmapOfBy"><span class="hs-identifier">isSubmapOfBy</span></a></span><span>
</span><span id="line-373"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#keys"><span class="hs-identifier">keys</span></a></span><span>
</span><span id="line-374"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#keysSet"><span class="hs-identifier">keysSet</span></a></span><span>
</span><span id="line-375"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#link"><span class="hs-identifier">link</span></a></span><span>
</span><span id="line-376"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#lookup"><span class="hs-identifier">lookup</span></a></span><span>
</span><span id="line-377"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#lookupGE"><span class="hs-identifier">lookupGE</span></a></span><span>
</span><span id="line-378"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#lookupGT"><span class="hs-identifier">lookupGT</span></a></span><span>
</span><span id="line-379"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#lookupIndex"><span class="hs-identifier">lookupIndex</span></a></span><span>
</span><span id="line-380"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#lookupLE"><span class="hs-identifier">lookupLE</span></a></span><span>
</span><span id="line-381"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#lookupLT"><span class="hs-identifier">lookupLT</span></a></span><span>
</span><span id="line-382"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#lookupMin"><span class="hs-identifier">lookupMin</span></a></span><span>
</span><span id="line-383"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#lookupMax"><span class="hs-identifier">lookupMax</span></a></span><span>
</span><span id="line-384"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#mapKeys"><span class="hs-identifier">mapKeys</span></a></span><span>
</span><span id="line-385"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#mapKeysMonotonic"><span class="hs-identifier">mapKeysMonotonic</span></a></span><span>
</span><span id="line-386"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#maxView"><span class="hs-identifier">maxView</span></a></span><span>
</span><span id="line-387"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#maxViewWithKey"><span class="hs-identifier">maxViewWithKey</span></a></span><span>
</span><span id="line-388"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#member"><span class="hs-identifier">member</span></a></span><span>
</span><span id="line-389"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#link2"><span class="hs-identifier">link2</span></a></span><span>
</span><span id="line-390"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#minView"><span class="hs-identifier">minView</span></a></span><span>
</span><span id="line-391"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#minViewWithKey"><span class="hs-identifier">minViewWithKey</span></a></span><span>
</span><span id="line-392"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#notMember"><span class="hs-identifier">notMember</span></a></span><span>
</span><span id="line-393"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#null"><span class="hs-identifier">null</span></a></span><span>
</span><span id="line-394"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#partition"><span class="hs-identifier">partition</span></a></span><span>
</span><span id="line-395"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#partitionWithKey"><span class="hs-identifier">partitionWithKey</span></a></span><span>
</span><span id="line-396"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#restrictKeys"><span class="hs-identifier">restrictKeys</span></a></span><span>
</span><span id="line-397"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#size"><span class="hs-identifier">size</span></a></span><span>
</span><span id="line-398"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#spanAntitone"><span class="hs-identifier">spanAntitone</span></a></span><span>
</span><span id="line-399"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#split"><span class="hs-identifier">split</span></a></span><span>
</span><span id="line-400"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#splitAt"><span class="hs-identifier">splitAt</span></a></span><span>
</span><span id="line-401"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#splitLookup"><span class="hs-identifier">splitLookup</span></a></span><span>
</span><span id="line-402"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#splitRoot"><span class="hs-identifier">splitRoot</span></a></span><span>
</span><span id="line-403"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#take"><span class="hs-identifier">take</span></a></span><span>
</span><span id="line-404"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#takeWhileAntitone"><span class="hs-identifier">takeWhileAntitone</span></a></span><span>
</span><span id="line-405"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#toList"><span class="hs-identifier">toList</span></a></span><span>
</span><span id="line-406"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#toAscList"><span class="hs-identifier">toAscList</span></a></span><span>
</span><span id="line-407"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#toDescList"><span class="hs-identifier">toDescList</span></a></span><span>
</span><span id="line-408"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#union"><span class="hs-identifier">union</span></a></span><span>
</span><span id="line-409"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#unions"><span class="hs-identifier">unions</span></a></span><span>
</span><span id="line-410"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#withoutKeys"><span class="hs-identifier">withoutKeys</span></a></span><span> </span><span class="hs-special">)</span><span class="hs-cpp">

#if defined(__GLASGOW_HASKELL__)
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Map.Internal.DeprecatedShowTree.html"><span class="hs-identifier">Data.Map.Internal.DeprecatedShowTree</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.DeprecatedShowTree.html#showTree"><span class="hs-identifier">showTree</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.DeprecatedShowTree.html#showTreeWith"><span class="hs-identifier">showTreeWith</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Map.Internal.Debug.html"><span class="hs-identifier">Data.Map.Internal.Debug</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.Debug.html#valid"><span class="hs-identifier">valid</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-416"></span><span>
</span><span id="line-417"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Applicative.html#"><span class="hs-identifier">Control.Applicative</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Functor.Const.html#Const"><span class="hs-identifier">Const</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#liftA3"><span class="hs-identifier">liftA3</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#if !MIN_VERSION_base(4,8,0)
</span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Control.Applicative</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Applicative</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="hs-operator">&lt;$&gt;</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.Set.Internal.html"><span class="hs-identifier">Data.Set.Internal</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Set</span></span><span>
</span><span id="line-422"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.Map.Internal.html"><span class="hs-identifier">Data.Map.Internal</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">L</span></span><span>
</span><span id="line-423"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html"><span class="hs-identifier">Utils.Containers.Internal.StrictPair</span></a></span><span>
</span><span id="line-424"></span><span>
</span><span id="line-425"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Bits.html#"><span class="hs-identifier">Data.Bits</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Bits.html#shiftL"><span class="hs-identifier">shiftL</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.Bits.html#shiftR"><span class="hs-identifier">shiftR</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__ &gt;= 709
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Coerce.html#"><span class="hs-identifier">Data.Coerce</span></a></span><span class="hs-cpp">
#endif
</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__ &amp;&amp; MIN_VERSION_base(4,8,0)
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Functor.Identity.html#"><span class="hs-identifier">Data.Functor.Identity</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Functor.Identity.html#Identity"><span class="hs-identifier">Identity</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-434"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../base/src/Data.Foldable.html#"><span class="hs-identifier">Data.Foldable</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Foldable</span></span><span class="hs-cpp">
#if !MIN_VERSION_base(4,8,0)
</span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.Foldable</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Foldable</span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-439"></span><span class="hs-comment">-- $strictness</span><span>
</span><span id="line-440"></span><span class="hs-comment">--</span><span>
</span><span id="line-441"></span><span class="hs-comment">-- This module satisfies the following strictness properties:</span><span>
</span><span id="line-442"></span><span class="hs-comment">--</span><span>
</span><span id="line-443"></span><span class="hs-comment">-- 1. Key arguments are evaluated to WHNF;</span><span>
</span><span id="line-444"></span><span class="hs-comment">--</span><span>
</span><span id="line-445"></span><span class="hs-comment">-- 2. Keys and values are evaluated to WHNF before they are stored in</span><span>
</span><span id="line-446"></span><span class="hs-comment">--    the map.</span><span>
</span><span id="line-447"></span><span class="hs-comment">--</span><span>
</span><span id="line-448"></span><span class="hs-comment">-- Here's an example illustrating the first property:</span><span>
</span><span id="line-449"></span><span class="hs-comment">--</span><span>
</span><span id="line-450"></span><span class="hs-comment">-- &gt; delete undefined m  ==  undefined</span><span>
</span><span id="line-451"></span><span class="hs-comment">--</span><span>
</span><span id="line-452"></span><span class="hs-comment">-- Here are some examples that illustrate the second property:</span><span>
</span><span id="line-453"></span><span class="hs-comment">--</span><span>
</span><span id="line-454"></span><span class="hs-comment">-- &gt; map (\ v -&gt; undefined) m  ==  undefined      -- m is not empty</span><span>
</span><span id="line-455"></span><span class="hs-comment">-- &gt; mapKeys (\ k -&gt; undefined) m  ==  undefined  -- m is not empty</span><span>
</span><span id="line-456"></span><span>
</span><span id="line-457"></span><span class="hs-comment">-- [Note: Pointer equality for sharing]</span><span>
</span><span id="line-458"></span><span class="hs-comment">--</span><span>
</span><span id="line-459"></span><span class="hs-comment">-- We use pointer equality to enhance sharing between the arguments</span><span>
</span><span id="line-460"></span><span class="hs-comment">-- of some functions and their results. Notably, we use it</span><span>
</span><span id="line-461"></span><span class="hs-comment">-- for insert, delete, union, intersection, and difference. We do</span><span>
</span><span id="line-462"></span><span class="hs-comment">-- *not* use it for functions, like insertWith, unionWithKey,</span><span>
</span><span id="line-463"></span><span class="hs-comment">-- intersectionWith, etc., that allow the user to modify the elements.</span><span>
</span><span id="line-464"></span><span class="hs-comment">-- While we *could* do so, we would only get sharing under fairly</span><span>
</span><span id="line-465"></span><span class="hs-comment">-- narrow conditions and at a relatively high cost. It does not seem</span><span>
</span><span id="line-466"></span><span class="hs-comment">-- worth the price.</span><span>
</span><span id="line-467"></span><span>
</span><span id="line-468"></span><span class="hs-comment">{--------------------------------------------------------------------
  Query
--------------------------------------------------------------------}</span><span>
</span><span id="line-471"></span><span>
</span><span id="line-472"></span><span class="hs-comment">-- | /O(log n)/. The expression @('findWithDefault' def k map)@ returns</span><span>
</span><span id="line-473"></span><span class="hs-comment">-- the value at key @k@ or returns default value @def@</span><span>
</span><span id="line-474"></span><span class="hs-comment">-- when the key is not in the map.</span><span>
</span><span id="line-475"></span><span class="hs-comment">--</span><span>
</span><span id="line-476"></span><span class="hs-comment">-- &gt; findWithDefault 'x' 1 (fromList [(5,'a'), (3,'b')]) == 'x'</span><span>
</span><span id="line-477"></span><span class="hs-comment">-- &gt; findWithDefault 'x' 5 (fromList [(5,'a'), (3,'b')]) == 'a'</span><span>
</span><span id="line-478"></span><span>
</span><span id="line-479"></span><span class="hs-comment">-- See Map.Internal.Note: Local 'go' functions and capturing</span><span>
</span><span id="line-480"></span><span id="local-6989586621679185880"><span id="local-6989586621679185881"><span class="annot"><a href="Data.Map.Strict.Internal.html#findWithDefault"><span class="hs-identifier hs-type">findWithDefault</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185881"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185880"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185881"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185881"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185880"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185880"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-481"></span><span id="findWithDefault"><span class="annot"><span class="annottext">findWithDefault :: forall k a. Ord k =&gt; a -&gt; k -&gt; Map k a -&gt; a
</span><a href="Data.Map.Strict.Internal.html#findWithDefault"><span class="hs-identifier hs-var hs-var">findWithDefault</span></a></span></span><span> </span><span id="local-6989586621679185208"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185208"><span class="hs-identifier hs-var">def</span></a></span></span><span> </span><span id="local-6989586621679185207"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185207"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185207"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; (Map k a -&gt; a) -&gt; Map k a -&gt; a
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; a
</span><a href="#local-6989586621679185206"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-482"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-483"></span><span>    </span><span id="local-6989586621679185206"><span class="annot"><span class="annottext">go :: Map k a -&gt; a
</span><a href="#local-6989586621679185206"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185208"><span class="hs-identifier hs-var">def</span></a></span><span>
</span><span id="line-484"></span><span>    </span><span class="annot"><a href="#local-6989586621679185206"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679185202"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185202"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679185201"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185201"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679185200"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185200"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679185199"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185199"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">k -&gt; k -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185207"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185202"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-485"></span><span>      </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; a
</span><a href="#local-6989586621679185206"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185200"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-486"></span><span>      </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; a
</span><a href="#local-6989586621679185206"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185199"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-487"></span><span>      </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185201"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#findWithDefault"><span class="hs-pragma hs-type">findWithDefault</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#else
</span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">findWithDefault</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-494"></span><span class="hs-comment">{--------------------------------------------------------------------
  Construction
--------------------------------------------------------------------}</span><span>
</span><span id="line-497"></span><span>
</span><span id="line-498"></span><span class="hs-comment">-- | /O(1)/. A map with a single element.</span><span>
</span><span id="line-499"></span><span class="hs-comment">--</span><span>
</span><span id="line-500"></span><span class="hs-comment">-- &gt; singleton 1 'a'        == fromList [(1, 'a')]</span><span>
</span><span id="line-501"></span><span class="hs-comment">-- &gt; size (singleton 1 'a') == 1</span><span>
</span><span id="line-502"></span><span>
</span><span id="line-503"></span><span id="local-6989586621679185870"><span id="local-6989586621679185871"><span class="annot"><a href="Data.Map.Strict.Internal.html#singleton"><span class="hs-identifier hs-type">singleton</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679185871"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185870"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185871"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185870"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-504"></span><span id="singleton"><span class="annot"><span class="annottext">singleton :: forall k a. k -&gt; a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#singleton"><span class="hs-identifier hs-var hs-var">singleton</span></a></span></span><span> </span><span id="local-6989586621679185197"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185197"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679185196"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185196"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185196"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Map k a -&gt; Map k a
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185197"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185196"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-505"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#singleton"><span class="hs-pragma hs-type">singleton</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-506"></span><span>
</span><span id="line-507"></span><span class="hs-comment">{--------------------------------------------------------------------
  Insertion
--------------------------------------------------------------------}</span><span>
</span><span id="line-510"></span><span class="hs-comment">-- | /O(log n)/. Insert a new key and value in the map.</span><span>
</span><span id="line-511"></span><span class="hs-comment">-- If the key is already present in the map, the associated value is</span><span>
</span><span id="line-512"></span><span class="hs-comment">-- replaced with the supplied value. 'insert' is equivalent to</span><span>
</span><span id="line-513"></span><span class="hs-comment">-- @'insertWith' 'const'@.</span><span>
</span><span id="line-514"></span><span class="hs-comment">--</span><span>
</span><span id="line-515"></span><span class="hs-comment">-- &gt; insert 5 'x' (fromList [(5,'a'), (3,'b')]) == fromList [(3, 'b'), (5, 'x')]</span><span>
</span><span id="line-516"></span><span class="hs-comment">-- &gt; insert 7 'x' (fromList [(5,'a'), (3,'b')]) == fromList [(3, 'b'), (5, 'a'), (7, 'x')]</span><span>
</span><span id="line-517"></span><span class="hs-comment">-- &gt; insert 5 'x' empty                         == singleton 5 'x'</span><span>
</span><span id="line-518"></span><span>
</span><span id="line-519"></span><span class="hs-comment">-- See Map.Internal.Note: Type of local 'go' function</span><span>
</span><span id="line-520"></span><span id="local-6989586621679185864"><span id="local-6989586621679185865"><span class="annot"><a href="Data.Map.Strict.Internal.html#insert"><span class="hs-identifier hs-type">insert</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185865"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185865"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185864"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185865"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185864"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185865"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185864"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-521"></span><span id="insert"><span class="annot"><span class="annottext">insert :: forall k a. Ord k =&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#insert"><span class="hs-identifier hs-var hs-var">insert</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a
forall k a. Ord k =&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679185193"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-522"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-523"></span><span>    </span><span id="local-6989586621679185191"><span id="local-6989586621679185192"><span class="annot"><a href="#local-6989586621679185193"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185192"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185192"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185191"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185192"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185191"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185192"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185191"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-524"></span><span>    </span><span id="local-6989586621679185193"><span class="annot"><span class="annottext">go :: forall k a. Ord k =&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679185193"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679185186"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185186"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679185185"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185185"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#singleton"><span class="hs-identifier hs-var">singleton</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185186"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185185"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-525"></span><span>    </span><span class="annot"><a href="#local-6989586621679185193"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679185184"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185184"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679185183"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185183"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679185182"><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679185182"><span class="hs-identifier hs-var">sz</span></a></span></span><span> </span><span id="local-6989586621679185181"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185181"><span class="hs-identifier hs-var">ky</span></a></span></span><span> </span><span id="local-6989586621679185180"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185180"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679185179"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185179"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679185178"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185178"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-526"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">k -&gt; k -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185184"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185181"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-527"></span><span>            </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#balanceL"><span class="hs-identifier hs-var">balanceL</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185181"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185180"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a
forall k a. Ord k =&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679185193"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185184"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185183"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185179"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185178"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-528"></span><span>            </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#balanceR"><span class="hs-identifier hs-var">balanceR</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185181"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185180"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185179"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a
forall k a. Ord k =&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679185193"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185184"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185183"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185178"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-529"></span><span>            </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679185182"><span class="hs-identifier hs-var">sz</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185184"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185183"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185179"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185178"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#insert"><span class="hs-pragma hs-type">insert</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#else
</span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">insert</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-536"></span><span class="hs-comment">-- | /O(log n)/. Insert with a function, combining new value and old value.</span><span>
</span><span id="line-537"></span><span class="hs-comment">-- @'insertWith' f key value mp@</span><span>
</span><span id="line-538"></span><span class="hs-comment">-- will insert the pair (key, value) into @mp@ if key does</span><span>
</span><span id="line-539"></span><span class="hs-comment">-- not exist in the map. If the key does exist, the function will</span><span>
</span><span id="line-540"></span><span class="hs-comment">-- insert the pair @(key, f new_value old_value)@.</span><span>
</span><span id="line-541"></span><span class="hs-comment">--</span><span>
</span><span id="line-542"></span><span class="hs-comment">-- &gt; insertWith (++) 5 &quot;xxx&quot; (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;xxxa&quot;)]</span><span>
</span><span id="line-543"></span><span class="hs-comment">-- &gt; insertWith (++) 7 &quot;xxx&quot; (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;a&quot;), (7, &quot;xxx&quot;)]</span><span>
</span><span id="line-544"></span><span class="hs-comment">-- &gt; insertWith (++) 5 &quot;xxx&quot; empty                         == singleton 5 &quot;xxx&quot;</span><span>
</span><span id="line-545"></span><span>
</span><span id="line-546"></span><span id="local-6989586621679185856"><span id="local-6989586621679185857"><span class="annot"><a href="Data.Map.Strict.Internal.html#insertWith"><span class="hs-identifier hs-type">insertWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185857"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185856"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185856"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185856"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185857"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185856"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185857"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185856"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185857"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185856"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-547"></span><span id="insertWith"><span class="annot"><span class="annottext">insertWith :: forall k a. Ord k =&gt; (a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#insertWith"><span class="hs-identifier hs-var hs-var">insertWith</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
forall k a. Ord k =&gt; (a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679185175"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-548"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-549"></span><span>    </span><span id="local-6989586621679185173"><span id="local-6989586621679185174"><span class="annot"><a href="#local-6989586621679185175"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185174"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185173"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185173"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185173"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185174"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185173"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185174"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185173"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185174"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185173"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-550"></span><span>    </span><span id="local-6989586621679185175"><span class="annot"><span class="annottext">go :: forall k a. Ord k =&gt; (a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679185175"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679185168"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185168"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679185167"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185167"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#singleton"><span class="hs-identifier hs-var">singleton</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185168"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185167"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-551"></span><span>    </span><span class="annot"><a href="#local-6989586621679185175"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679185166"><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679185166"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679185165"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185165"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679185164"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185164"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679185163"><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679185163"><span class="hs-identifier hs-var">sy</span></a></span></span><span> </span><span id="local-6989586621679185162"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185162"><span class="hs-identifier hs-var">ky</span></a></span></span><span> </span><span id="local-6989586621679185161"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185161"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679185160"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185160"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679185159"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185159"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-552"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">k -&gt; k -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185165"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185162"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-553"></span><span>            </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#balanceL"><span class="hs-identifier hs-var">balanceL</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185162"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185161"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
forall k a. Ord k =&gt; (a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679185175"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679185166"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185165"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185164"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185160"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185159"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-554"></span><span>            </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#balanceR"><span class="hs-identifier hs-var">balanceR</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185162"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185161"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185160"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
forall k a. Ord k =&gt; (a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679185175"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679185166"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185165"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185164"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185159"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-555"></span><span>            </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679185158"><span class="annot"><span class="annottext">y' :: a
</span><a href="#local-6989586621679185158"><span class="hs-identifier hs-var hs-var">y'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679185166"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185164"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185161"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679185163"><span class="hs-identifier hs-var">sy</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185165"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185158"><span class="hs-identifier hs-var">y'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185160"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185159"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#insertWith"><span class="hs-pragma hs-type">insertWith</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#else
</span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">insertWith</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-562"></span><span id="local-6989586621679185156"><span id="local-6989586621679185157"><span class="annot"><a href="Data.Map.Strict.Internal.html#insertWithR"><span class="hs-identifier hs-type">insertWithR</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185157"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185156"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185156"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185156"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185157"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185156"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185157"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185156"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185157"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185156"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-563"></span><span id="insertWithR"><span class="annot"><span class="annottext">insertWithR :: forall k a. Ord k =&gt; (a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#insertWithR"><span class="hs-identifier hs-var hs-var">insertWithR</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
forall k a. Ord k =&gt; (a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679185152"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-564"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-565"></span><span>    </span><span id="local-6989586621679185150"><span id="local-6989586621679185151"><span class="annot"><a href="#local-6989586621679185152"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185151"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185150"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185150"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185150"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185151"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185150"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185151"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185150"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185151"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185150"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-566"></span><span>    </span><span id="local-6989586621679185152"><span class="annot"><span class="annottext">go :: forall k a. Ord k =&gt; (a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679185152"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679185145"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185145"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679185144"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185144"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#singleton"><span class="hs-identifier hs-var">singleton</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185145"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185144"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-567"></span><span>    </span><span class="annot"><a href="#local-6989586621679185152"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679185143"><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679185143"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679185142"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185142"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679185141"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185141"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679185140"><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679185140"><span class="hs-identifier hs-var">sy</span></a></span></span><span> </span><span id="local-6989586621679185139"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185139"><span class="hs-identifier hs-var">ky</span></a></span></span><span> </span><span id="local-6989586621679185138"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185138"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679185137"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185137"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679185136"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185136"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-568"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">k -&gt; k -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185142"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185139"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-569"></span><span>            </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#balanceL"><span class="hs-identifier hs-var">balanceL</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185139"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185138"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
forall k a. Ord k =&gt; (a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679185152"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679185143"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185142"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185141"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185137"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185136"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-570"></span><span>            </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#balanceR"><span class="hs-identifier hs-var">balanceR</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185139"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185138"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185137"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
forall k a. Ord k =&gt; (a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679185152"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679185143"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185142"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185141"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185136"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-571"></span><span>            </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679185135"><span class="annot"><span class="annottext">y' :: a
</span><a href="#local-6989586621679185135"><span class="hs-identifier hs-var hs-var">y'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679185143"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185138"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185141"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679185140"><span class="hs-identifier hs-var">sy</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185139"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185135"><span class="hs-identifier hs-var">y'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185137"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185136"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#insertWithR"><span class="hs-pragma hs-type">insertWithR</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#else
</span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">insertWithR</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-578"></span><span class="hs-comment">-- | /O(log n)/. Insert with a function, combining key, new value and old value.</span><span>
</span><span id="line-579"></span><span class="hs-comment">-- @'insertWithKey' f key value mp@</span><span>
</span><span id="line-580"></span><span class="hs-comment">-- will insert the pair (key, value) into @mp@ if key does</span><span>
</span><span id="line-581"></span><span class="hs-comment">-- not exist in the map. If the key does exist, the function will</span><span>
</span><span id="line-582"></span><span class="hs-comment">-- insert the pair @(key,f key new_value old_value)@.</span><span>
</span><span id="line-583"></span><span class="hs-comment">-- Note that the key passed to f is the same key passed to 'insertWithKey'.</span><span>
</span><span id="line-584"></span><span class="hs-comment">--</span><span>
</span><span id="line-585"></span><span class="hs-comment">-- &gt; let f key new_value old_value = (show key) ++ &quot;:&quot; ++ new_value ++ &quot;|&quot; ++ old_value</span><span>
</span><span id="line-586"></span><span class="hs-comment">-- &gt; insertWithKey f 5 &quot;xxx&quot; (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;5:xxx|a&quot;)]</span><span>
</span><span id="line-587"></span><span class="hs-comment">-- &gt; insertWithKey f 7 &quot;xxx&quot; (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;a&quot;), (7, &quot;xxx&quot;)]</span><span>
</span><span id="line-588"></span><span class="hs-comment">-- &gt; insertWithKey f 5 &quot;xxx&quot; empty                         == singleton 5 &quot;xxx&quot;</span><span>
</span><span id="line-589"></span><span>
</span><span id="line-590"></span><span class="hs-comment">-- See Map.Internal.Note: Type of local 'go' function</span><span>
</span><span id="line-591"></span><span id="local-6989586621679185846"><span id="local-6989586621679185847"><span class="annot"><a href="Data.Map.Strict.Internal.html#insertWithKey"><span class="hs-identifier hs-type">insertWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185847"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185847"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185846"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185846"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185846"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185847"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185846"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185847"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185846"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185847"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185846"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-592"></span><span id="insertWithKey"><span class="annot"><span class="annottext">insertWithKey :: forall k a.
Ord k =&gt;
(k -&gt; a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#insertWithKey"><span class="hs-identifier hs-var hs-var">insertWithKey</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
forall k a.
Ord k =&gt;
(k -&gt; a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679185132"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-593"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-594"></span><span>    </span><span id="local-6989586621679185130"><span id="local-6989586621679185131"><span class="annot"><a href="#local-6989586621679185132"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185131"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185131"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185130"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185130"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185130"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185131"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185130"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185131"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185130"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185131"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185130"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-595"></span><span>    </span><span class="hs-comment">-- Forcing `kx` may look redundant, but it's possible `compare` will</span><span>
</span><span id="line-596"></span><span>    </span><span class="hs-comment">-- be lazy.</span><span>
</span><span id="line-597"></span><span>    </span><span id="local-6989586621679185132"><span class="annot"><span class="annottext">go :: forall k a.
Ord k =&gt;
(k -&gt; a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679185132"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679185125"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185125"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679185124"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185124"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#singleton"><span class="hs-identifier hs-var">singleton</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185125"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185124"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-598"></span><span>    </span><span class="annot"><a href="#local-6989586621679185132"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679185123"><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679185123"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679185122"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185122"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679185121"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185121"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679185120"><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679185120"><span class="hs-identifier hs-var">sy</span></a></span></span><span> </span><span id="local-6989586621679185119"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185119"><span class="hs-identifier hs-var">ky</span></a></span></span><span> </span><span id="local-6989586621679185118"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185118"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679185117"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185117"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679185116"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185116"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-599"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">k -&gt; k -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185122"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185119"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-600"></span><span>            </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#balanceL"><span class="hs-identifier hs-var">balanceL</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185119"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185118"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(k -&gt; a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
forall k a.
Ord k =&gt;
(k -&gt; a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679185132"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679185123"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185122"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185121"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185117"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185116"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-601"></span><span>            </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#balanceR"><span class="hs-identifier hs-var">balanceR</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185119"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185118"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185117"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(k -&gt; a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
forall k a.
Ord k =&gt;
(k -&gt; a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679185132"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679185123"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185122"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185121"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185116"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-602"></span><span>            </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679185115"><span class="annot"><span class="annottext">x' :: a
</span><a href="#local-6989586621679185115"><span class="hs-identifier hs-var hs-var">x'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679185123"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185122"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185121"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185118"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-603"></span><span>                  </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679185120"><span class="hs-identifier hs-var">sy</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185122"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185115"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185117"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185116"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#insertWithKey"><span class="hs-pragma hs-type">insertWithKey</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#else
</span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">insertWithKey</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-610"></span><span id="local-6989586621679185113"><span id="local-6989586621679185114"><span class="annot"><a href="Data.Map.Strict.Internal.html#insertWithKeyR"><span class="hs-identifier hs-type">insertWithKeyR</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185114"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185114"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185113"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185113"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185113"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185114"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185113"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185114"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185113"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185114"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185113"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-611"></span><span id="insertWithKeyR"><span class="annot"><span class="annottext">insertWithKeyR :: forall k a.
Ord k =&gt;
(k -&gt; a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#insertWithKeyR"><span class="hs-identifier hs-var hs-var">insertWithKeyR</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
forall k a.
Ord k =&gt;
(k -&gt; a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679185109"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-612"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-613"></span><span>    </span><span id="local-6989586621679185107"><span id="local-6989586621679185108"><span class="annot"><a href="#local-6989586621679185109"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185108"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185108"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185107"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185107"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185107"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185108"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185107"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185108"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185107"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185108"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185107"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-614"></span><span>    </span><span class="hs-comment">-- Forcing `kx` may look redundant, but it's possible `compare` will</span><span>
</span><span id="line-615"></span><span>    </span><span class="hs-comment">-- be lazy.</span><span>
</span><span id="line-616"></span><span>    </span><span id="local-6989586621679185109"><span class="annot"><span class="annottext">go :: forall k a.
Ord k =&gt;
(k -&gt; a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679185109"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679185102"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185102"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679185101"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185101"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#singleton"><span class="hs-identifier hs-var">singleton</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185102"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185101"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-617"></span><span>    </span><span class="annot"><a href="#local-6989586621679185109"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679185100"><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679185100"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679185099"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185099"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679185098"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185098"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679185097"><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679185097"><span class="hs-identifier hs-var">sy</span></a></span></span><span> </span><span id="local-6989586621679185096"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185096"><span class="hs-identifier hs-var">ky</span></a></span></span><span> </span><span id="local-6989586621679185095"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185095"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679185094"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185094"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679185093"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185093"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-618"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">k -&gt; k -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185099"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185096"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-619"></span><span>            </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#balanceL"><span class="hs-identifier hs-var">balanceL</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185096"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185095"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(k -&gt; a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
forall k a.
Ord k =&gt;
(k -&gt; a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679185109"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679185100"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185099"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185098"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185094"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185093"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-620"></span><span>            </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#balanceR"><span class="hs-identifier hs-var">balanceR</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185096"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185095"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185094"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(k -&gt; a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
forall k a.
Ord k =&gt;
(k -&gt; a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679185109"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679185100"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185099"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185098"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185093"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-621"></span><span>            </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679185092"><span class="annot"><span class="annottext">y' :: a
</span><a href="#local-6989586621679185092"><span class="hs-identifier hs-var hs-var">y'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679185100"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185096"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185095"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185098"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-622"></span><span>                  </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679185097"><span class="hs-identifier hs-var">sy</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185096"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185092"><span class="hs-identifier hs-var">y'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185094"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185093"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#insertWithKeyR"><span class="hs-pragma hs-type">insertWithKeyR</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#else
</span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">insertWithKeyR</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-629"></span><span class="hs-comment">-- | /O(log n)/. Combines insert operation with old value retrieval.</span><span>
</span><span id="line-630"></span><span class="hs-comment">-- The expression (@'insertLookupWithKey' f k x map@)</span><span>
</span><span id="line-631"></span><span class="hs-comment">-- is a pair where the first element is equal to (@'lookup' k map@)</span><span>
</span><span id="line-632"></span><span class="hs-comment">-- and the second element equal to (@'insertWithKey' f k x map@).</span><span>
</span><span id="line-633"></span><span class="hs-comment">--</span><span>
</span><span id="line-634"></span><span class="hs-comment">-- &gt; let f key new_value old_value = (show key) ++ &quot;:&quot; ++ new_value ++ &quot;|&quot; ++ old_value</span><span>
</span><span id="line-635"></span><span class="hs-comment">-- &gt; insertLookupWithKey f 5 &quot;xxx&quot; (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == (Just &quot;a&quot;, fromList [(3, &quot;b&quot;), (5, &quot;5:xxx|a&quot;)])</span><span>
</span><span id="line-636"></span><span class="hs-comment">-- &gt; insertLookupWithKey f 7 &quot;xxx&quot; (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == (Nothing,  fromList [(3, &quot;b&quot;), (5, &quot;a&quot;), (7, &quot;xxx&quot;)])</span><span>
</span><span id="line-637"></span><span class="hs-comment">-- &gt; insertLookupWithKey f 5 &quot;xxx&quot; empty                         == (Nothing,  singleton 5 &quot;xxx&quot;)</span><span>
</span><span id="line-638"></span><span class="hs-comment">--</span><span>
</span><span id="line-639"></span><span class="hs-comment">-- This is how to define @insertLookup@ using @insertLookupWithKey@:</span><span>
</span><span id="line-640"></span><span class="hs-comment">--</span><span>
</span><span id="line-641"></span><span class="hs-comment">-- &gt; let insertLookup kx x t = insertLookupWithKey (\_ a _ -&gt; a) kx x t</span><span>
</span><span id="line-642"></span><span class="hs-comment">-- &gt; insertLookup 5 &quot;x&quot; (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == (Just &quot;a&quot;, fromList [(3, &quot;b&quot;), (5, &quot;x&quot;)])</span><span>
</span><span id="line-643"></span><span class="hs-comment">-- &gt; insertLookup 7 &quot;x&quot; (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == (Nothing,  fromList [(3, &quot;b&quot;), (5, &quot;a&quot;), (7, &quot;x&quot;)])</span><span>
</span><span id="line-644"></span><span>
</span><span id="line-645"></span><span class="hs-comment">-- See Map.Internal.Note: Type of local 'go' function</span><span>
</span><span id="line-646"></span><span id="local-6989586621679185836"><span id="local-6989586621679185837"><span class="annot"><a href="Data.Map.Strict.Internal.html#insertLookupWithKey"><span class="hs-identifier hs-type">insertLookupWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185837"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185837"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185836"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185836"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185836"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185837"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185836"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185837"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185836"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-647"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185836"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185837"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185836"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-648"></span><span id="insertLookupWithKey"><span class="annot"><span class="annottext">insertLookupWithKey :: forall k a.
Ord k =&gt;
(k -&gt; a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; (Maybe a, Map k a)
</span><a href="Data.Map.Strict.Internal.html#insertLookupWithKey"><span class="hs-identifier hs-var hs-var">insertLookupWithKey</span></a></span></span><span> </span><span id="local-6989586621679185089"><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679185089"><span class="hs-identifier hs-var">f0</span></a></span></span><span> </span><span id="local-6989586621679185088"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185088"><span class="hs-identifier hs-var">kx0</span></a></span></span><span> </span><span id="local-6989586621679185087"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185087"><span class="hs-identifier hs-var">x0</span></a></span></span><span> </span><span id="local-6989586621679185086"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185086"><span class="hs-identifier hs-var">t0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrictPair (Maybe a) (Map k a) -&gt; (Maybe a, Map k a)
forall a b. StrictPair a b -&gt; (a, b)
</span><a href="Utils.Containers.Internal.StrictPair.html#toPair"><span class="hs-identifier hs-var">toPair</span></a></span><span> </span><span class="annot"><span class="annottext">(StrictPair (Maybe a) (Map k a) -&gt; (Maybe a, Map k a))
-&gt; StrictPair (Maybe a) (Map k a) -&gt; (Maybe a, Map k a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(k -&gt; a -&gt; a -&gt; a)
-&gt; k -&gt; a -&gt; Map k a -&gt; StrictPair (Maybe a) (Map k a)
forall k a.
Ord k =&gt;
(k -&gt; a -&gt; a -&gt; a)
-&gt; k -&gt; a -&gt; Map k a -&gt; StrictPair (Maybe a) (Map k a)
</span><a href="#local-6989586621679185084"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679185089"><span class="hs-identifier hs-var">f0</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185088"><span class="hs-identifier hs-var">kx0</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185087"><span class="hs-identifier hs-var">x0</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185086"><span class="hs-identifier hs-var">t0</span></a></span><span>
</span><span id="line-649"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-650"></span><span>    </span><span id="local-6989586621679185826"><span id="local-6989586621679185827"><span class="annot"><a href="#local-6989586621679185084"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185827"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185827"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185826"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185826"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185826"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185827"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185826"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185827"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185826"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#StrictPair"><span class="hs-identifier hs-type">StrictPair</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185826"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185827"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185826"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-651"></span><span>    </span><span id="local-6989586621679185084"><span class="annot"><span class="annottext">go :: forall k a.
Ord k =&gt;
(k -&gt; a -&gt; a -&gt; a)
-&gt; k -&gt; a -&gt; Map k a -&gt; StrictPair (Maybe a) (Map k a)
</span><a href="#local-6989586621679185084"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679185081"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185081"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679185080"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185080"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; Map k a -&gt; StrictPair (Maybe a) (Map k a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#singleton"><span class="hs-identifier hs-var">singleton</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185081"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185080"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-652"></span><span>    </span><span class="annot"><a href="#local-6989586621679185084"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679185078"><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679185078"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679185077"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185077"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679185076"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185076"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679185075"><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679185075"><span class="hs-identifier hs-var">sy</span></a></span></span><span> </span><span id="local-6989586621679185074"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185074"><span class="hs-identifier hs-var">ky</span></a></span></span><span> </span><span id="local-6989586621679185073"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185073"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679185072"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185072"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679185071"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185071"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-653"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">k -&gt; k -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185077"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185074"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-654"></span><span>            </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679185069"><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679185069"><span class="hs-identifier hs-var">found</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679185068"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185068"><span class="hs-identifier hs-var">l'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; a -&gt; a -&gt; a)
-&gt; k -&gt; a -&gt; Map k a -&gt; StrictPair (Maybe a) (Map k a)
forall k a.
Ord k =&gt;
(k -&gt; a -&gt; a -&gt; a)
-&gt; k -&gt; a -&gt; Map k a -&gt; StrictPair (Maybe a) (Map k a)
</span><a href="#local-6989586621679185084"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679185078"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185077"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185076"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185072"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-655"></span><span>                  </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679185069"><span class="hs-identifier hs-var">found</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; Map k a -&gt; StrictPair (Maybe a) (Map k a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#balanceL"><span class="hs-identifier hs-var">balanceL</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185074"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185073"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185068"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185071"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-656"></span><span>            </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679185066"><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679185066"><span class="hs-identifier hs-var">found</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679185065"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185065"><span class="hs-identifier hs-var">r'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; a -&gt; a -&gt; a)
-&gt; k -&gt; a -&gt; Map k a -&gt; StrictPair (Maybe a) (Map k a)
forall k a.
Ord k =&gt;
(k -&gt; a -&gt; a -&gt; a)
-&gt; k -&gt; a -&gt; Map k a -&gt; StrictPair (Maybe a) (Map k a)
</span><a href="#local-6989586621679185084"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679185078"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185077"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185076"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185071"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-657"></span><span>                  </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679185066"><span class="hs-identifier hs-var">found</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; Map k a -&gt; StrictPair (Maybe a) (Map k a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#balanceR"><span class="hs-identifier hs-var">balanceR</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185074"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185073"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185072"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185065"><span class="hs-identifier hs-var">r'</span></a></span><span>
</span><span id="line-658"></span><span>            </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679185064"><span class="annot"><span class="annottext">x' :: a
</span><a href="#local-6989586621679185064"><span class="hs-identifier hs-var hs-var">x'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679185078"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185077"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185076"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185073"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-659"></span><span>                  </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185064"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">a
-&gt; StrictPair (Maybe a) (Map k a) -&gt; StrictPair (Maybe a) (Map k a)
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185073"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; Map k a -&gt; StrictPair (Maybe a) (Map k a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679185075"><span class="hs-identifier hs-var">sy</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185077"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185064"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185072"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185071"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#insertLookupWithKey"><span class="hs-pragma hs-type">insertLookupWithKey</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#else
</span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">insertLookupWithKey</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-666"></span><span class="hs-comment">{--------------------------------------------------------------------
  Deletion
--------------------------------------------------------------------}</span><span>
</span><span id="line-669"></span><span>
</span><span id="line-670"></span><span class="hs-comment">-- | /O(log n)/. Update a value at a specific key with the result of the provided function.</span><span>
</span><span id="line-671"></span><span class="hs-comment">-- When the key is not</span><span>
</span><span id="line-672"></span><span class="hs-comment">-- a member of the map, the original map is returned.</span><span>
</span><span id="line-673"></span><span class="hs-comment">--</span><span>
</span><span id="line-674"></span><span class="hs-comment">-- &gt; adjust (&quot;new &quot; ++) 5 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;new a&quot;)]</span><span>
</span><span id="line-675"></span><span class="hs-comment">-- &gt; adjust (&quot;new &quot; ++) 7 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;a&quot;)]</span><span>
</span><span id="line-676"></span><span class="hs-comment">-- &gt; adjust (&quot;new &quot; ++) 7 empty                         == empty</span><span>
</span><span id="line-677"></span><span>
</span><span id="line-678"></span><span id="local-6989586621679185820"><span id="local-6989586621679185821"><span class="annot"><a href="Data.Map.Strict.Internal.html#adjust"><span class="hs-identifier hs-type">adjust</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185821"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185820"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185820"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185821"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185821"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185820"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185821"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185820"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-679"></span><span id="adjust"><span class="annot"><span class="annottext">adjust :: forall k a. Ord k =&gt; (a -&gt; a) -&gt; k -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#adjust"><span class="hs-identifier hs-var hs-var">adjust</span></a></span></span><span> </span><span id="local-6989586621679185061"><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621679185061"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; a -&gt; a) -&gt; k -&gt; Map k a -&gt; Map k a
forall k a. Ord k =&gt; (k -&gt; a -&gt; a) -&gt; k -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#adjustWithKey"><span class="hs-identifier hs-var">adjustWithKey</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">k
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679185060"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185060"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621679185061"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185060"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#adjust"><span class="hs-pragma hs-type">adjust</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#else
</span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">adjust</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-686"></span><span class="hs-comment">-- | /O(log n)/. Adjust a value at a specific key. When the key is not</span><span>
</span><span id="line-687"></span><span class="hs-comment">-- a member of the map, the original map is returned.</span><span>
</span><span id="line-688"></span><span class="hs-comment">--</span><span>
</span><span id="line-689"></span><span class="hs-comment">-- &gt; let f key x = (show key) ++ &quot;:new &quot; ++ x</span><span>
</span><span id="line-690"></span><span class="hs-comment">-- &gt; adjustWithKey f 5 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;5:new a&quot;)]</span><span>
</span><span id="line-691"></span><span class="hs-comment">-- &gt; adjustWithKey f 7 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;a&quot;)]</span><span>
</span><span id="line-692"></span><span class="hs-comment">-- &gt; adjustWithKey f 7 empty                         == empty</span><span>
</span><span id="line-693"></span><span>
</span><span id="line-694"></span><span id="local-6989586621679185816"><span id="local-6989586621679185817"><span class="annot"><a href="Data.Map.Strict.Internal.html#adjustWithKey"><span class="hs-identifier hs-type">adjustWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185817"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185817"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185816"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185816"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185817"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185817"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185816"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185817"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185816"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-695"></span><span id="adjustWithKey"><span class="annot"><span class="annottext">adjustWithKey :: forall k a. Ord k =&gt; (k -&gt; a -&gt; a) -&gt; k -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#adjustWithKey"><span class="hs-identifier hs-var hs-var">adjustWithKey</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; a -&gt; a) -&gt; k -&gt; Map k a -&gt; Map k a
forall k a. Ord k =&gt; (k -&gt; a -&gt; a) -&gt; k -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679185057"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-696"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-697"></span><span>    </span><span id="local-6989586621679185055"><span id="local-6989586621679185056"><span class="annot"><a href="#local-6989586621679185057"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185056"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185056"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185055"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185055"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185056"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185056"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185055"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185056"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185055"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-698"></span><span>    </span><span id="local-6989586621679185057"><span class="annot"><span class="annottext">go :: forall k a. Ord k =&gt; (k -&gt; a -&gt; a) -&gt; k -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679185057"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">k
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-699"></span><span>    </span><span class="annot"><a href="#local-6989586621679185057"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679185050"><span class="annot"><span class="annottext">k -&gt; a -&gt; a
</span><a href="#local-6989586621679185050"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679185049"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185049"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679185048"><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679185048"><span class="hs-identifier hs-var">sx</span></a></span></span><span> </span><span id="local-6989586621679185047"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185047"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679185046"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185046"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679185045"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185045"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679185044"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185044"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-700"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">k -&gt; k -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185049"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185047"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-701"></span><span>           </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679185048"><span class="hs-identifier hs-var">sx</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185047"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185046"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(k -&gt; a -&gt; a) -&gt; k -&gt; Map k a -&gt; Map k a
forall k a. Ord k =&gt; (k -&gt; a -&gt; a) -&gt; k -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679185057"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; a
</span><a href="#local-6989586621679185050"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185049"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185045"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185044"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-702"></span><span>           </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679185048"><span class="hs-identifier hs-var">sx</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185047"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185046"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185045"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(k -&gt; a -&gt; a) -&gt; k -&gt; Map k a -&gt; Map k a
forall k a. Ord k =&gt; (k -&gt; a -&gt; a) -&gt; k -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679185057"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; a
</span><a href="#local-6989586621679185050"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185049"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185044"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-703"></span><span>           </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679185048"><span class="hs-identifier hs-var">sx</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185047"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185043"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185045"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185044"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-704"></span><span>             </span><span class="hs-keyword">where</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679185043"><span class="annot"><span class="annottext">x' :: a
</span><a href="#local-6989586621679185043"><span class="hs-identifier hs-var hs-var">x'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; a
</span><a href="#local-6989586621679185050"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185047"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185046"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#adjustWithKey"><span class="hs-pragma hs-type">adjustWithKey</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#else
</span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">adjustWithKey</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-711"></span><span class="hs-comment">-- | /O(log n)/. The expression (@'update' f k map@) updates the value @x@</span><span>
</span><span id="line-712"></span><span class="hs-comment">-- at @k@ (if it is in the map). If (@f x@) is 'Nothing', the element is</span><span>
</span><span id="line-713"></span><span class="hs-comment">-- deleted. If it is (@'Just' y@), the key @k@ is bound to the new value @y@.</span><span>
</span><span id="line-714"></span><span class="hs-comment">--</span><span>
</span><span id="line-715"></span><span class="hs-comment">-- &gt; let f x = if x == &quot;a&quot; then Just &quot;new a&quot; else Nothing</span><span>
</span><span id="line-716"></span><span class="hs-comment">-- &gt; update f 5 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;new a&quot;)]</span><span>
</span><span id="line-717"></span><span class="hs-comment">-- &gt; update f 7 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;a&quot;)]</span><span>
</span><span id="line-718"></span><span class="hs-comment">-- &gt; update f 3 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == singleton 5 &quot;a&quot;</span><span>
</span><span id="line-719"></span><span>
</span><span id="line-720"></span><span id="local-6989586621679185810"><span id="local-6989586621679185811"><span class="annot"><a href="Data.Map.Strict.Internal.html#update"><span class="hs-identifier hs-type">update</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185811"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185810"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185810"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185811"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185811"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185810"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185811"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185810"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-721"></span><span id="update"><span class="annot"><span class="annottext">update :: forall k a. Ord k =&gt; (a -&gt; Maybe a) -&gt; k -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#update"><span class="hs-identifier hs-var hs-var">update</span></a></span></span><span> </span><span id="local-6989586621679185040"><span class="annot"><span class="annottext">a -&gt; Maybe a
</span><a href="#local-6989586621679185040"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; a -&gt; Maybe a) -&gt; k -&gt; Map k a -&gt; Map k a
forall k a. Ord k =&gt; (k -&gt; a -&gt; Maybe a) -&gt; k -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#updateWithKey"><span class="hs-identifier hs-var">updateWithKey</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">k
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679185039"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185039"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe a
</span><a href="#local-6989586621679185040"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185039"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#update"><span class="hs-pragma hs-type">update</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#else
</span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">update</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-728"></span><span class="hs-comment">-- | /O(log n)/. The expression (@'updateWithKey' f k map@) updates the</span><span>
</span><span id="line-729"></span><span class="hs-comment">-- value @x@ at @k@ (if it is in the map). If (@f k x@) is 'Nothing',</span><span>
</span><span id="line-730"></span><span class="hs-comment">-- the element is deleted. If it is (@'Just' y@), the key @k@ is bound</span><span>
</span><span id="line-731"></span><span class="hs-comment">-- to the new value @y@.</span><span>
</span><span id="line-732"></span><span class="hs-comment">--</span><span>
</span><span id="line-733"></span><span class="hs-comment">-- &gt; let f k x = if x == &quot;a&quot; then Just ((show k) ++ &quot;:new a&quot;) else Nothing</span><span>
</span><span id="line-734"></span><span class="hs-comment">-- &gt; updateWithKey f 5 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;5:new a&quot;)]</span><span>
</span><span id="line-735"></span><span class="hs-comment">-- &gt; updateWithKey f 7 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;a&quot;)]</span><span>
</span><span id="line-736"></span><span class="hs-comment">-- &gt; updateWithKey f 3 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == singleton 5 &quot;a&quot;</span><span>
</span><span id="line-737"></span><span>
</span><span id="line-738"></span><span class="hs-comment">-- See Map.Internal.Note: Type of local 'go' function</span><span>
</span><span id="line-739"></span><span id="local-6989586621679185806"><span id="local-6989586621679185807"><span class="annot"><a href="Data.Map.Strict.Internal.html#updateWithKey"><span class="hs-identifier hs-type">updateWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185807"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185807"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185806"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185806"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185807"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185807"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185806"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185807"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185806"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-740"></span><span id="updateWithKey"><span class="annot"><span class="annottext">updateWithKey :: forall k a. Ord k =&gt; (k -&gt; a -&gt; Maybe a) -&gt; k -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#updateWithKey"><span class="hs-identifier hs-var hs-var">updateWithKey</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; a -&gt; Maybe a) -&gt; k -&gt; Map k a -&gt; Map k a
forall k a. Ord k =&gt; (k -&gt; a -&gt; Maybe a) -&gt; k -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679185036"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-741"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-742"></span><span>    </span><span id="local-6989586621679185034"><span id="local-6989586621679185035"><span class="annot"><a href="#local-6989586621679185036"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185035"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185035"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185034"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185034"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185035"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185035"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185034"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185035"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185034"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-743"></span><span>    </span><span id="local-6989586621679185036"><span class="annot"><span class="annottext">go :: forall k a. Ord k =&gt; (k -&gt; a -&gt; Maybe a) -&gt; k -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679185036"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">k
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-744"></span><span>    </span><span class="annot"><a href="#local-6989586621679185036"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679185029"><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679185029"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679185028"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185028"><span class="hs-identifier hs-var">k</span></a></span></span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679185027"><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679185027"><span class="hs-identifier hs-var">sx</span></a></span></span><span> </span><span id="local-6989586621679185026"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185026"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679185025"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185025"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679185024"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185024"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679185023"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185023"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-745"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">k -&gt; k -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185028"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185026"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-746"></span><span>           </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#balanceR"><span class="hs-identifier hs-var">balanceR</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185026"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185025"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(k -&gt; a -&gt; Maybe a) -&gt; k -&gt; Map k a -&gt; Map k a
forall k a. Ord k =&gt; (k -&gt; a -&gt; Maybe a) -&gt; k -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679185036"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679185029"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185028"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185024"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185023"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-747"></span><span>           </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#balanceL"><span class="hs-identifier hs-var">balanceL</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185026"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185025"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185024"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(k -&gt; a -&gt; Maybe a) -&gt; k -&gt; Map k a -&gt; Map k a
forall k a. Ord k =&gt; (k -&gt; a -&gt; Maybe a) -&gt; k -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679185036"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679185029"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185028"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185023"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-748"></span><span>           </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679185029"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185026"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185025"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-749"></span><span>                   </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679185022"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185022"><span class="hs-identifier hs-var">x'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185022"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Map k a -&gt; Map k a
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679185027"><span class="hs-identifier hs-var">sx</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185026"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185022"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185024"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185023"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-750"></span><span>                   </span><span class="annot"><span class="annottext">Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; Map k a -&gt; Map k a
forall k a. Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#glue"><span class="hs-identifier hs-var">glue</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185024"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185023"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#updateWithKey"><span class="hs-pragma hs-type">updateWithKey</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#else
</span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">updateWithKey</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-757"></span><span class="hs-comment">-- | /O(log n)/. Lookup and update. See also 'updateWithKey'.</span><span>
</span><span id="line-758"></span><span class="hs-comment">-- The function returns changed value, if it is updated.</span><span>
</span><span id="line-759"></span><span class="hs-comment">-- Returns the original key value if the map entry is deleted.</span><span>
</span><span id="line-760"></span><span class="hs-comment">--</span><span>
</span><span id="line-761"></span><span class="hs-comment">-- &gt; let f k x = if x == &quot;a&quot; then Just ((show k) ++ &quot;:new a&quot;) else Nothing</span><span>
</span><span id="line-762"></span><span class="hs-comment">-- &gt; updateLookupWithKey f 5 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == (Just &quot;5:new a&quot;, fromList [(3, &quot;b&quot;), (5, &quot;5:new a&quot;)])</span><span>
</span><span id="line-763"></span><span class="hs-comment">-- &gt; updateLookupWithKey f 7 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == (Nothing,  fromList [(3, &quot;b&quot;), (5, &quot;a&quot;)])</span><span>
</span><span id="line-764"></span><span class="hs-comment">-- &gt; updateLookupWithKey f 3 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == (Just &quot;b&quot;, singleton 5 &quot;a&quot;)</span><span>
</span><span id="line-765"></span><span>
</span><span id="line-766"></span><span class="hs-comment">-- See Map.Internal.Note: Type of local 'go' function</span><span>
</span><span id="line-767"></span><span id="local-6989586621679185798"><span id="local-6989586621679185799"><span class="annot"><a href="Data.Map.Strict.Internal.html#updateLookupWithKey"><span class="hs-identifier hs-type">updateLookupWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185799"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185799"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185798"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185798"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185799"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185799"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185798"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185798"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185799"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185798"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-768"></span><span id="updateLookupWithKey"><span class="annot"><span class="annottext">updateLookupWithKey :: forall k a.
Ord k =&gt;
(k -&gt; a -&gt; Maybe a) -&gt; k -&gt; Map k a -&gt; (Maybe a, Map k a)
</span><a href="Data.Map.Strict.Internal.html#updateLookupWithKey"><span class="hs-identifier hs-var hs-var">updateLookupWithKey</span></a></span></span><span> </span><span id="local-6989586621679185019"><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679185019"><span class="hs-identifier hs-var">f0</span></a></span></span><span> </span><span id="local-6989586621679185018"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185018"><span class="hs-identifier hs-var">k0</span></a></span></span><span> </span><span id="local-6989586621679185017"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185017"><span class="hs-identifier hs-var">t0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrictPair (Maybe a) (Map k a) -&gt; (Maybe a, Map k a)
forall a b. StrictPair a b -&gt; (a, b)
</span><a href="Utils.Containers.Internal.StrictPair.html#toPair"><span class="hs-identifier hs-var">toPair</span></a></span><span> </span><span class="annot"><span class="annottext">(StrictPair (Maybe a) (Map k a) -&gt; (Maybe a, Map k a))
-&gt; StrictPair (Maybe a) (Map k a) -&gt; (Maybe a, Map k a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(k -&gt; a -&gt; Maybe a)
-&gt; k -&gt; Map k a -&gt; StrictPair (Maybe a) (Map k a)
forall k a.
Ord k =&gt;
(k -&gt; a -&gt; Maybe a)
-&gt; k -&gt; Map k a -&gt; StrictPair (Maybe a) (Map k a)
</span><a href="#local-6989586621679185016"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679185019"><span class="hs-identifier hs-var">f0</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185018"><span class="hs-identifier hs-var">k0</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185017"><span class="hs-identifier hs-var">t0</span></a></span><span>
</span><span id="line-769"></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-770"></span><span>   </span><span id="local-6989586621679185794"><span id="local-6989586621679185795"><span class="annot"><a href="#local-6989586621679185016"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185795"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185795"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185794"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185794"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185795"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185795"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185794"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#StrictPair"><span class="hs-identifier hs-type">StrictPair</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185794"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185795"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185794"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-771"></span><span>   </span><span id="local-6989586621679185016"><span class="annot"><span class="annottext">go :: forall k a.
Ord k =&gt;
(k -&gt; a -&gt; Maybe a)
-&gt; k -&gt; Map k a -&gt; StrictPair (Maybe a) (Map k a)
</span><a href="#local-6989586621679185016"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">k
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; Map k a -&gt; StrictPair (Maybe a) (Map k a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-772"></span><span>   </span><span class="annot"><a href="#local-6989586621679185016"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679185013"><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679185013"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679185012"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185012"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679185011"><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679185011"><span class="hs-identifier hs-var">sx</span></a></span></span><span> </span><span id="local-6989586621679185010"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185010"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679185009"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185009"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679185008"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185008"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679185007"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185007"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-773"></span><span>          </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">k -&gt; k -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185012"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185010"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-774"></span><span>               </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679185005"><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679185005"><span class="hs-identifier hs-var">found</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679185004"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185004"><span class="hs-identifier hs-var">l'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; a -&gt; Maybe a)
-&gt; k -&gt; Map k a -&gt; StrictPair (Maybe a) (Map k a)
forall k a.
Ord k =&gt;
(k -&gt; a -&gt; Maybe a)
-&gt; k -&gt; Map k a -&gt; StrictPair (Maybe a) (Map k a)
</span><a href="#local-6989586621679185016"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679185013"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185012"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185008"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-775"></span><span>                     </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679185005"><span class="hs-identifier hs-var">found</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; Map k a -&gt; StrictPair (Maybe a) (Map k a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#balanceR"><span class="hs-identifier hs-var">balanceR</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185010"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185009"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185004"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185007"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-776"></span><span>               </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679185002"><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679185002"><span class="hs-identifier hs-var">found</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679185001"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185001"><span class="hs-identifier hs-var">r'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; a -&gt; Maybe a)
-&gt; k -&gt; Map k a -&gt; StrictPair (Maybe a) (Map k a)
forall k a.
Ord k =&gt;
(k -&gt; a -&gt; Maybe a)
-&gt; k -&gt; Map k a -&gt; StrictPair (Maybe a) (Map k a)
</span><a href="#local-6989586621679185016"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679185013"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185012"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185007"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-777"></span><span>                     </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679185002"><span class="hs-identifier hs-var">found</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; Map k a -&gt; StrictPair (Maybe a) (Map k a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#balanceL"><span class="hs-identifier hs-var">balanceL</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185010"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185009"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185008"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185001"><span class="hs-identifier hs-var">r'</span></a></span><span>
</span><span id="line-778"></span><span>               </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679185013"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185010"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185009"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-779"></span><span>                       </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679185000"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185000"><span class="hs-identifier hs-var">x'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185000"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">a
-&gt; StrictPair (Maybe a) (Map k a) -&gt; StrictPair (Maybe a) (Map k a)
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185000"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; Map k a -&gt; StrictPair (Maybe a) (Map k a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679185011"><span class="hs-identifier hs-var">sx</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679185010"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185000"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185008"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185007"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-780"></span><span>                       </span><span class="annot"><span class="annottext">Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679185009"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; Map k a -&gt; StrictPair (Maybe a) (Map k a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; Map k a -&gt; Map k a
forall k a. Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#glue"><span class="hs-identifier hs-var">glue</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185008"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679185007"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#updateLookupWithKey"><span class="hs-pragma hs-type">updateLookupWithKey</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#else
</span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">updateLookupWithKey</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-787"></span><span class="hs-comment">-- | /O(log n)/. The expression (@'alter' f k map@) alters the value @x@ at @k@, or absence thereof.</span><span>
</span><span id="line-788"></span><span class="hs-comment">-- 'alter' can be used to insert, delete, or update a value in a 'Map'.</span><span>
</span><span id="line-789"></span><span class="hs-comment">-- In short : @'lookup' k ('alter' f k m) = f ('lookup' k m)@.</span><span>
</span><span id="line-790"></span><span class="hs-comment">--</span><span>
</span><span id="line-791"></span><span class="hs-comment">-- &gt; let f _ = Nothing</span><span>
</span><span id="line-792"></span><span class="hs-comment">-- &gt; alter f 7 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;a&quot;)]</span><span>
</span><span id="line-793"></span><span class="hs-comment">-- &gt; alter f 5 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == singleton 3 &quot;b&quot;</span><span>
</span><span id="line-794"></span><span class="hs-comment">-- &gt;</span><span>
</span><span id="line-795"></span><span class="hs-comment">-- &gt; let f _ = Just &quot;c&quot;</span><span>
</span><span id="line-796"></span><span class="hs-comment">-- &gt; alter f 7 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;a&quot;), (7, &quot;c&quot;)]</span><span>
</span><span id="line-797"></span><span class="hs-comment">-- &gt; alter f 5 (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;c&quot;)]</span><span>
</span><span id="line-798"></span><span>
</span><span id="line-799"></span><span class="hs-comment">-- See Map.Internal.Note: Type of local 'go' function</span><span>
</span><span id="line-800"></span><span id="local-6989586621679185790"><span id="local-6989586621679185791"><span class="annot"><a href="Data.Map.Strict.Internal.html#alter"><span class="hs-identifier hs-type">alter</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185791"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185790"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185790"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185791"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185791"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185790"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185791"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185790"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-801"></span><span id="alter"><span class="annot"><span class="annottext">alter :: forall k a.
Ord k =&gt;
(Maybe a -&gt; Maybe a) -&gt; k -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#alter"><span class="hs-identifier hs-var hs-var">alter</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Maybe a -&gt; Maybe a) -&gt; k -&gt; Map k a -&gt; Map k a
forall k a.
Ord k =&gt;
(Maybe a -&gt; Maybe a) -&gt; k -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679184997"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-802"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-803"></span><span>    </span><span id="local-6989586621679184995"><span id="local-6989586621679184996"><span class="annot"><a href="#local-6989586621679184997"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679184996"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184995"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184995"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679184996"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184996"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184995"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184996"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184995"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-804"></span><span>    </span><span id="local-6989586621679184997"><span class="annot"><span class="annottext">go :: forall k a.
Ord k =&gt;
(Maybe a -&gt; Maybe a) -&gt; k -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679184997"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679184990"><span class="annot"><span class="annottext">Maybe a -&gt; Maybe a
</span><a href="#local-6989586621679184990"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679184989"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184989"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; Maybe a
</span><a href="#local-6989586621679184990"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-805"></span><span>               </span><span class="annot"><span class="annottext">Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-806"></span><span>               </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679184988"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184988"><span class="hs-identifier hs-var">x</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#singleton"><span class="hs-identifier hs-var">singleton</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184989"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184988"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-807"></span><span>
</span><span id="line-808"></span><span>    </span><span class="annot"><a href="#local-6989586621679184997"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679184987"><span class="annot"><span class="annottext">Maybe a -&gt; Maybe a
</span><a href="#local-6989586621679184987"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184986"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184986"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679184985"><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679184985"><span class="hs-identifier hs-var">sx</span></a></span></span><span> </span><span id="local-6989586621679184984"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184984"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679184983"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184983"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679184982"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184982"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679184981"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184981"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">k -&gt; k -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184986"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184984"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-809"></span><span>               </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#balance"><span class="hs-identifier hs-var">balance</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184984"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184983"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Maybe a -&gt; Maybe a) -&gt; k -&gt; Map k a -&gt; Map k a
forall k a.
Ord k =&gt;
(Maybe a -&gt; Maybe a) -&gt; k -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679184997"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; Maybe a
</span><a href="#local-6989586621679184987"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184986"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184982"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184981"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-810"></span><span>               </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#balance"><span class="hs-identifier hs-var">balance</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184984"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184983"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184982"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Maybe a -&gt; Maybe a) -&gt; k -&gt; Map k a -&gt; Map k a
forall k a.
Ord k =&gt;
(Maybe a -&gt; Maybe a) -&gt; k -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679184997"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; Maybe a
</span><a href="#local-6989586621679184987"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184986"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184981"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-811"></span><span>               </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; Maybe a
</span><a href="#local-6989586621679184987"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184983"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-812"></span><span>                       </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679184980"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184980"><span class="hs-identifier hs-var">x'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184980"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Map k a -&gt; Map k a
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679184985"><span class="hs-identifier hs-var">sx</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184984"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184980"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184982"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184981"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-813"></span><span>                       </span><span class="annot"><span class="annottext">Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; Map k a -&gt; Map k a
forall k a. Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#glue"><span class="hs-identifier hs-var">glue</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184982"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184981"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#alter"><span class="hs-pragma hs-type">alter</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#else
</span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">alter</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-820"></span><span class="hs-comment">-- | /O(log n)/. The expression (@'alterF' f k map@) alters the value @x@ at @k@, or absence thereof.</span><span>
</span><span id="line-821"></span><span class="hs-comment">-- 'alterF' can be used to inspect, insert, delete, or update a value in a 'Map'.</span><span>
</span><span id="line-822"></span><span class="hs-comment">-- In short: @'lookup' k \&lt;$\&gt; 'alterF' f k m = f ('lookup' k m)@.</span><span>
</span><span id="line-823"></span><span class="hs-comment">--</span><span>
</span><span id="line-824"></span><span class="hs-comment">-- Example:</span><span>
</span><span id="line-825"></span><span class="hs-comment">--</span><span>
</span><span id="line-826"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-827"></span><span class="hs-comment">-- interactiveAlter :: Int -&gt; Map Int String -&gt; IO (Map Int String)</span><span>
</span><span id="line-828"></span><span class="hs-comment">-- interactiveAlter k m = alterF f k m where</span><span>
</span><span id="line-829"></span><span class="hs-comment">--   f Nothing = do</span><span>
</span><span id="line-830"></span><span class="hs-comment">--      putStrLn $ show k ++</span><span>
</span><span id="line-831"></span><span class="hs-comment">--          &quot; was not found in the map. Would you like to add it?&quot;</span><span>
</span><span id="line-832"></span><span class="hs-comment">--      getUserResponse1 :: IO (Maybe String)</span><span>
</span><span id="line-833"></span><span class="hs-comment">--   f (Just old) = do</span><span>
</span><span id="line-834"></span><span class="hs-comment">--      putStrLn $ &quot;The key is currently bound to &quot; ++ show old ++</span><span>
</span><span id="line-835"></span><span class="hs-comment">--          &quot;. Would you like to change or delete it?&quot;</span><span>
</span><span id="line-836"></span><span class="hs-comment">--      getUserResponse2 :: IO (Maybe String)</span><span>
</span><span id="line-837"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-838"></span><span class="hs-comment">--</span><span>
</span><span id="line-839"></span><span class="hs-comment">-- 'alterF' is the most general operation for working with an individual</span><span>
</span><span id="line-840"></span><span class="hs-comment">-- key that may or may not be in a given map. When used with trivial</span><span>
</span><span id="line-841"></span><span class="hs-comment">-- functors like 'Identity' and 'Const', it is often slightly slower than</span><span>
</span><span id="line-842"></span><span class="hs-comment">-- more specialized combinators like 'lookup' and 'insert'. However, when</span><span>
</span><span id="line-843"></span><span class="hs-comment">-- the functor is non-trivial and key comparison is not particularly cheap,</span><span>
</span><span id="line-844"></span><span class="hs-comment">-- it is the fastest way.</span><span>
</span><span id="line-845"></span><span class="hs-comment">--</span><span>
</span><span id="line-846"></span><span class="hs-comment">-- Note on rewrite rules:</span><span>
</span><span id="line-847"></span><span class="hs-comment">--</span><span>
</span><span id="line-848"></span><span class="hs-comment">-- This module includes GHC rewrite rules to optimize 'alterF' for</span><span>
</span><span id="line-849"></span><span class="hs-comment">-- the 'Const' and 'Identity' functors. In general, these rules</span><span>
</span><span id="line-850"></span><span class="hs-comment">-- improve performance. The sole exception is that when using</span><span>
</span><span id="line-851"></span><span class="hs-comment">-- 'Identity', deleting a key that is already absent takes longer</span><span>
</span><span id="line-852"></span><span class="hs-comment">-- than it would without the rules. If you expect this to occur</span><span>
</span><span id="line-853"></span><span class="hs-comment">-- a very large fraction of the time, you might consider using a</span><span>
</span><span id="line-854"></span><span class="hs-comment">-- private copy of the 'Identity' type.</span><span>
</span><span id="line-855"></span><span class="hs-comment">--</span><span>
</span><span id="line-856"></span><span class="hs-comment">-- Note: 'alterF' is a flipped version of the @at@ combinator from</span><span>
</span><span id="line-857"></span><span class="hs-comment">-- @Control.Lens.At@.</span><span>
</span><span id="line-858"></span><span class="hs-comment">--</span><span>
</span><span id="line-859"></span><span class="hs-comment">-- @since 0.5.8</span><span>
</span><span id="line-860"></span><span id="local-6989586621679185783"><span id="local-6989586621679185784"><span id="local-6989586621679185785"><span class="annot"><a href="Data.Map.Strict.Internal.html#alterF"><span class="hs-identifier hs-type">alterF</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185785"><span class="hs-identifier hs-type">f</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185784"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-861"></span><span>       </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185783"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185785"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185783"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185784"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185784"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185783"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185785"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185784"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185783"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-862"></span><span id="alterF"><span class="annot"><span class="annottext">alterF :: forall (f :: * -&gt; *) k a.
(Functor f, Ord k) =&gt;
(Maybe a -&gt; f (Maybe a)) -&gt; k -&gt; Map k a -&gt; f (Map k a)
</span><a href="Data.Map.Strict.Internal.html#alterF"><span class="hs-identifier hs-var hs-var">alterF</span></a></span></span><span> </span><span id="local-6989586621679184975"><span class="annot"><span class="annottext">Maybe a -&gt; f (Maybe a)
</span><a href="#local-6989586621679184975"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184974"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184974"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679184973"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184973"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">AreWeStrict
-&gt; k -&gt; (Maybe a -&gt; f (Maybe a)) -&gt; Map k a -&gt; f (Map k a)
forall (f :: * -&gt; *) k a.
(Functor f, Ord k) =&gt;
AreWeStrict
-&gt; k -&gt; (Maybe a -&gt; f (Maybe a)) -&gt; Map k a -&gt; f (Map k a)
</span><a href="Data.Map.Internal.html#atKeyImpl"><span class="hs-identifier hs-var">atKeyImpl</span></a></span><span> </span><span class="annot"><span class="annottext">AreWeStrict
</span><a href="Data.Map.Internal.html#Strict"><span class="hs-identifier hs-var">Strict</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184974"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; f (Maybe a)
</span><a href="#local-6989586621679184975"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184973"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-cpp">

#ifndef __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">alterF</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#else
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">2</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#alterF"><span class="hs-pragma hs-type">alterF</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-868"></span><span>
</span><span id="line-869"></span><span class="hs-comment">-- We can save a little time by recognizing the special case of</span><span>
</span><span id="line-870"></span><span class="hs-comment">-- `Control.Applicative.Const` and just doing a lookup.</span><span>
</span><span id="line-871"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-872"></span><span id="local-6989586621679184970"><span id="local-6989586621679184971"><span class="annot"><span class="hs-pragma">&quot;alterF/Const&quot;</span></span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679184969"><span class="annot"><a href="#local-6989586621679184969"><span class="hs-pragma hs-var">k</span></a></span></span><span> </span><span class="hs-pragma">(</span><span id="local-6989586621679184968"><span class="annot"><a href="#local-6989586621679184968"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-pragma hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184971"><span class="hs-pragma hs-type">a</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Functor.Const.html#Const"><span class="hs-pragma hs-type">Const</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184970"><span class="hs-pragma hs-type">b</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-pragma hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184971"><span class="hs-pragma hs-type">a</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#alterF"><span class="hs-pragma hs-type">alterF</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184968"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184969"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="hs-pragma">\</span><span id="local-6989586621679184967"><span class="annot"><a href="#local-6989586621679184967"><span class="hs-pragma hs-var">m</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Functor.Const.html#Const"><span class="hs-pragma hs-type">Const</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#."><span class="hs-pragma hs-type">.</span></a></span><span> </span><span class="annot"><a href="../../base/src/Data.Functor.Const.html#getConst"><span class="hs-pragma hs-var">getConst</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#."><span class="hs-pragma hs-type">.</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184968"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%24"><span class="hs-pragma hs-type">$</span></a></span><span> </span><span class="annot"><a href="Data.Map.Internal.html#lookup"><span class="hs-pragma hs-type">lookup</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184969"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184967"><span class="hs-pragma hs-type">m</span></a></span></span></span><span>
</span><span id="line-873"></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#if MIN_VERSION_base(4,8,0)
</span><span class="hs-comment">-- base 4.8 and above include Data.Functor.Identity, so we can</span><span>
</span><span id="line-876"></span><span class="hs-comment">-- save a pretty decent amount of time by handling it specially.</span><span>
</span><span id="line-877"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-878"></span><span class="annot"><span class="hs-pragma">&quot;alterF/Identity&quot;</span></span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679184963"><span class="annot"><a href="#local-6989586621679184963"><span class="hs-pragma hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679184962"><span class="annot"><a href="#local-6989586621679184962"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#alterF"><span class="hs-pragma hs-type">alterF</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184962"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184963"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#atKeyIdentity"><span class="hs-pragma hs-type">atKeyIdentity</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184963"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184962"><span class="hs-pragma hs-type">f</span></a></span><span>
</span><span id="line-879"></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-880"></span><span>
</span><span id="line-881"></span><span id="local-6989586621679185774"><span id="local-6989586621679185775"><span class="annot"><a href="Data.Map.Strict.Internal.html#atKeyIdentity"><span class="hs-identifier hs-type">atKeyIdentity</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185775"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185775"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185774"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Functor.Identity.html#Identity"><span class="hs-identifier hs-type">Identity</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185774"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185775"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185774"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Functor.Identity.html#Identity"><span class="hs-identifier hs-type">Identity</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185775"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185774"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-882"></span><span id="atKeyIdentity"><span class="annot"><span class="annottext">atKeyIdentity :: forall k a.
Ord k =&gt;
k
-&gt; (Maybe a -&gt; Identity (Maybe a)) -&gt; Map k a -&gt; Identity (Map k a)
</span><a href="Data.Map.Strict.Internal.html#atKeyIdentity"><span class="hs-identifier hs-var hs-var">atKeyIdentity</span></a></span></span><span> </span><span id="local-6989586621679184957"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184957"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679184956"><span class="annot"><span class="annottext">Maybe a -&gt; Identity (Maybe a)
</span><a href="#local-6989586621679184956"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184955"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184955"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; Identity (Map k a)
forall a. a -&gt; Identity a
</span><a href="../../base/src/Data.Functor.Identity.html#Identity"><span class="hs-identifier hs-var">Identity</span></a></span><span> </span><span class="annot"><span class="annottext">(Map k a -&gt; Identity (Map k a)) -&gt; Map k a -&gt; Identity (Map k a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">AreWeStrict -&gt; k -&gt; (Maybe a -&gt; Maybe a) -&gt; Map k a -&gt; Map k a
forall k a.
Ord k =&gt;
AreWeStrict -&gt; k -&gt; (Maybe a -&gt; Maybe a) -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#atKeyPlain"><span class="hs-identifier hs-var">atKeyPlain</span></a></span><span> </span><span class="annot"><span class="annottext">AreWeStrict
</span><a href="Data.Map.Internal.html#Strict"><span class="hs-identifier hs-var">Strict</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184957"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Maybe a -&gt; Identity (Maybe a)) -&gt; Maybe a -&gt; Maybe a
</span><span class="hs-identifier hs-var">coerce</span></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; Identity (Maybe a)
</span><a href="#local-6989586621679184956"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184955"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-883"></span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#atKeyIdentity"><span class="hs-pragma hs-type">atKeyIdentity</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span class="hs-cpp">#endif
</span><span>
</span><span id="line-887"></span><span class="hs-comment">{--------------------------------------------------------------------
  Indexing
--------------------------------------------------------------------}</span><span>
</span><span id="line-890"></span><span>
</span><span id="line-891"></span><span class="hs-comment">-- | /O(log n)/. Update the element at /index/. Calls 'error' when an</span><span>
</span><span id="line-892"></span><span class="hs-comment">-- invalid index is used.</span><span>
</span><span id="line-893"></span><span class="hs-comment">--</span><span>
</span><span id="line-894"></span><span class="hs-comment">-- &gt; updateAt (\ _ _ -&gt; Just &quot;x&quot;) 0    (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;x&quot;), (5, &quot;a&quot;)]</span><span>
</span><span id="line-895"></span><span class="hs-comment">-- &gt; updateAt (\ _ _ -&gt; Just &quot;x&quot;) 1    (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;x&quot;)]</span><span>
</span><span id="line-896"></span><span class="hs-comment">-- &gt; updateAt (\ _ _ -&gt; Just &quot;x&quot;) 2    (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)])    Error: index out of range</span><span>
</span><span id="line-897"></span><span class="hs-comment">-- &gt; updateAt (\ _ _ -&gt; Just &quot;x&quot;) (-1) (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)])    Error: index out of range</span><span>
</span><span id="line-898"></span><span class="hs-comment">-- &gt; updateAt (\_ _  -&gt; Nothing)  0    (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == singleton 5 &quot;a&quot;</span><span>
</span><span id="line-899"></span><span class="hs-comment">-- &gt; updateAt (\_ _  -&gt; Nothing)  1    (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == singleton 3 &quot;b&quot;</span><span>
</span><span id="line-900"></span><span class="hs-comment">-- &gt; updateAt (\_ _  -&gt; Nothing)  2    (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)])    Error: index out of range</span><span>
</span><span id="line-901"></span><span class="hs-comment">-- &gt; updateAt (\_ _  -&gt; Nothing)  (-1) (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)])    Error: index out of range</span><span>
</span><span id="line-902"></span><span>
</span><span id="line-903"></span><span id="local-6989586621679185765"><span id="local-6989586621679185766"><span class="annot"><a href="Data.Map.Strict.Internal.html#updateAt"><span class="hs-identifier hs-type">updateAt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185766"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185765"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185765"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185766"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185765"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185766"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185765"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-904"></span><span id="updateAt"><span class="annot"><span class="annottext">updateAt :: forall k a. (k -&gt; a -&gt; Maybe a) -&gt; Size -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#updateAt"><span class="hs-identifier hs-var hs-var">updateAt</span></a></span></span><span> </span><span id="local-6989586621679184945"><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679184945"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184944"><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679184944"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span id="local-6989586621679184943"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184943"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679184944"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Size -&gt; Map k a -&gt; Map k a
</span><span class="hs-operator hs-var">`seq`</span></span><span>
</span><span id="line-905"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184943"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-906"></span><span>    </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; Map k a
forall a. HasCallStack =&gt; [Char] -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;Map.updateAt: index out of range&quot;</span></span><span>
</span><span id="line-907"></span><span>    </span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679184941"><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679184941"><span class="hs-identifier hs-var">sx</span></a></span></span><span> </span><span id="local-6989586621679184940"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184940"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679184939"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184939"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679184938"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184938"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679184937"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184937"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Size -&gt; Size -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><span class="hs-identifier hs-var">compare</span></span><span> </span><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679184944"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679184936"><span class="hs-identifier hs-var">sizeL</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-908"></span><span>      </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">LT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#balanceR"><span class="hs-identifier hs-var">balanceR</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184940"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184939"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(k -&gt; a -&gt; Maybe a) -&gt; Size -&gt; Map k a -&gt; Map k a
forall k a. (k -&gt; a -&gt; Maybe a) -&gt; Size -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#updateAt"><span class="hs-identifier hs-var">updateAt</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679184945"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679184944"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184938"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184937"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-909"></span><span>      </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">GT</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#balanceL"><span class="hs-identifier hs-var">balanceL</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184940"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184939"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184938"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(k -&gt; a -&gt; Maybe a) -&gt; Size -&gt; Map k a -&gt; Map k a
forall k a. (k -&gt; a -&gt; Maybe a) -&gt; Size -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#updateAt"><span class="hs-identifier hs-var">updateAt</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679184945"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679184944"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Size -&gt; Size -&gt; Size
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679184936"><span class="hs-identifier hs-var">sizeL</span></a></span><span class="annot"><span class="annottext">Size -&gt; Size -&gt; Size
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Size
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184937"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-910"></span><span>      </span><span class="annot"><span class="annottext">Ordering
</span><span class="hs-identifier hs-var">EQ</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679184945"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184940"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184939"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-911"></span><span>              </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679184935"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184935"><span class="hs-identifier hs-var">x'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184935"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Map k a -&gt; Map k a
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679184941"><span class="hs-identifier hs-var">sx</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184940"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184935"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184938"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184937"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-912"></span><span>              </span><span class="annot"><span class="annottext">Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; Map k a -&gt; Map k a
forall k a. Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#glue"><span class="hs-identifier hs-var">glue</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184938"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184937"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-913"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-914"></span><span>        </span><span id="local-6989586621679184936"><span class="annot"><span class="annottext">sizeL :: Size
</span><a href="#local-6989586621679184936"><span class="hs-identifier hs-var hs-var">sizeL</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; Size
forall k a. Map k a -&gt; Size
</span><a href="Data.Map.Internal.html#size"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184938"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-915"></span><span>
</span><span id="line-916"></span><span class="hs-comment">{--------------------------------------------------------------------
  Minimal, Maximal
--------------------------------------------------------------------}</span><span>
</span><span id="line-919"></span><span>
</span><span id="line-920"></span><span class="hs-comment">-- | /O(log n)/. Update the value at the minimal key.</span><span>
</span><span id="line-921"></span><span class="hs-comment">--</span><span>
</span><span id="line-922"></span><span class="hs-comment">-- &gt; updateMin (\ a -&gt; Just (&quot;X&quot; ++ a)) (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;Xb&quot;), (5, &quot;a&quot;)]</span><span>
</span><span id="line-923"></span><span class="hs-comment">-- &gt; updateMin (\ _ -&gt; Nothing)         (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == singleton 5 &quot;a&quot;</span><span>
</span><span id="line-924"></span><span>
</span><span id="line-925"></span><span id="local-6989586621679185755"><span id="local-6989586621679185756"><span class="annot"><a href="Data.Map.Strict.Internal.html#updateMin"><span class="hs-identifier hs-type">updateMin</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185756"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185756"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185755"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185756"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185755"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185756"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-926"></span><span id="updateMin"><span class="annot"><span class="annottext">updateMin :: forall a k. (a -&gt; Maybe a) -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#updateMin"><span class="hs-identifier hs-var hs-var">updateMin</span></a></span></span><span> </span><span id="local-6989586621679184934"><span class="annot"><span class="annottext">a -&gt; Maybe a
</span><a href="#local-6989586621679184934"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184933"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184933"><span class="hs-identifier hs-var">m</span></a></span></span><span>
</span><span id="line-927"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; a -&gt; Maybe a) -&gt; Map k a -&gt; Map k a
forall k a. (k -&gt; a -&gt; Maybe a) -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#updateMinWithKey"><span class="hs-identifier hs-var">updateMinWithKey</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">k
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184932"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184932"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe a
</span><a href="#local-6989586621679184934"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184932"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184933"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-928"></span><span>
</span><span id="line-929"></span><span class="hs-comment">-- | /O(log n)/. Update the value at the maximal key.</span><span>
</span><span id="line-930"></span><span class="hs-comment">--</span><span>
</span><span id="line-931"></span><span class="hs-comment">-- &gt; updateMax (\ a -&gt; Just (&quot;X&quot; ++ a)) (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;Xa&quot;)]</span><span>
</span><span id="line-932"></span><span class="hs-comment">-- &gt; updateMax (\ _ -&gt; Nothing)         (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == singleton 3 &quot;b&quot;</span><span>
</span><span id="line-933"></span><span>
</span><span id="line-934"></span><span id="local-6989586621679184930"><span id="local-6989586621679184931"><span class="annot"><a href="Data.Map.Strict.Internal.html#updateMax"><span class="hs-identifier hs-type">updateMax</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679184931"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184931"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184930"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184931"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184930"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184931"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-935"></span><span id="updateMax"><span class="annot"><span class="annottext">updateMax :: forall a k. (a -&gt; Maybe a) -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#updateMax"><span class="hs-identifier hs-var hs-var">updateMax</span></a></span></span><span> </span><span id="local-6989586621679184929"><span class="annot"><span class="annottext">a -&gt; Maybe a
</span><a href="#local-6989586621679184929"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184928"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184928"><span class="hs-identifier hs-var">m</span></a></span></span><span>
</span><span id="line-936"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; a -&gt; Maybe a) -&gt; Map k a -&gt; Map k a
forall k a. (k -&gt; a -&gt; Maybe a) -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#updateMaxWithKey"><span class="hs-identifier hs-var">updateMaxWithKey</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">k
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184927"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184927"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe a
</span><a href="#local-6989586621679184929"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184927"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184928"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-937"></span><span>
</span><span id="line-938"></span><span>
</span><span id="line-939"></span><span class="hs-comment">-- | /O(log n)/. Update the value at the minimal key.</span><span>
</span><span id="line-940"></span><span class="hs-comment">--</span><span>
</span><span id="line-941"></span><span class="hs-comment">-- &gt; updateMinWithKey (\ k a -&gt; Just ((show k) ++ &quot;:&quot; ++ a)) (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3,&quot;3:b&quot;), (5,&quot;a&quot;)]</span><span>
</span><span id="line-942"></span><span class="hs-comment">-- &gt; updateMinWithKey (\ _ _ -&gt; Nothing)                     (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == singleton 5 &quot;a&quot;</span><span>
</span><span id="line-943"></span><span>
</span><span id="line-944"></span><span id="local-6989586621679185751"><span id="local-6989586621679185752"><span class="annot"><a href="Data.Map.Strict.Internal.html#updateMinWithKey"><span class="hs-identifier hs-type">updateMinWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185752"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185751"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185751"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185752"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185751"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185752"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185751"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-945"></span><span id="updateMinWithKey"><span class="annot"><span class="annottext">updateMinWithKey :: forall k a. (k -&gt; a -&gt; Maybe a) -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#updateMinWithKey"><span class="hs-identifier hs-var hs-var">updateMinWithKey</span></a></span></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>                 </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-946"></span><span class="annot"><a href="Data.Map.Strict.Internal.html#updateMinWithKey"><span class="hs-identifier hs-var">updateMinWithKey</span></a></span><span> </span><span id="local-6989586621679184926"><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679184926"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679184925"><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679184925"><span class="hs-identifier hs-var">sx</span></a></span></span><span> </span><span id="local-6989586621679184924"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184924"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679184923"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184923"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span id="local-6989586621679184922"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184922"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679184926"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184924"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184923"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-947"></span><span>                                           </span><span class="annot"><span class="annottext">Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184922"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-948"></span><span>                                           </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679184921"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184921"><span class="hs-identifier hs-var">x'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184921"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Map k a -&gt; Map k a
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679184925"><span class="hs-identifier hs-var">sx</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184924"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184921"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184922"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-949"></span><span class="annot"><a href="Data.Map.Strict.Internal.html#updateMinWithKey"><span class="hs-identifier hs-var">updateMinWithKey</span></a></span><span> </span><span id="local-6989586621679184920"><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679184920"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184919"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184919"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679184918"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184918"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679184917"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184917"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679184916"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184916"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#balanceR"><span class="hs-identifier hs-var">balanceR</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184919"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184918"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(k -&gt; a -&gt; Maybe a) -&gt; Map k a -&gt; Map k a
forall k a. (k -&gt; a -&gt; Maybe a) -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#updateMinWithKey"><span class="hs-identifier hs-var">updateMinWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679184920"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184917"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184916"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-950"></span><span>
</span><span id="line-951"></span><span class="hs-comment">-- | /O(log n)/. Update the value at the maximal key.</span><span>
</span><span id="line-952"></span><span class="hs-comment">--</span><span>
</span><span id="line-953"></span><span class="hs-comment">-- &gt; updateMaxWithKey (\ k a -&gt; Just ((show k) ++ &quot;:&quot; ++ a)) (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3,&quot;b&quot;), (5,&quot;5:a&quot;)]</span><span>
</span><span id="line-954"></span><span class="hs-comment">-- &gt; updateMaxWithKey (\ _ _ -&gt; Nothing)                     (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == singleton 3 &quot;b&quot;</span><span>
</span><span id="line-955"></span><span>
</span><span id="line-956"></span><span id="local-6989586621679184914"><span id="local-6989586621679184915"><span class="annot"><a href="Data.Map.Strict.Internal.html#updateMaxWithKey"><span class="hs-identifier hs-type">updateMaxWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679184915"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679184914"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184914"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184915"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184914"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184915"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184914"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-957"></span><span id="updateMaxWithKey"><span class="annot"><span class="annottext">updateMaxWithKey :: forall k a. (k -&gt; a -&gt; Maybe a) -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#updateMaxWithKey"><span class="hs-identifier hs-var hs-var">updateMaxWithKey</span></a></span></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>                 </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-958"></span><span class="annot"><a href="Data.Map.Strict.Internal.html#updateMaxWithKey"><span class="hs-identifier hs-var">updateMaxWithKey</span></a></span><span> </span><span id="local-6989586621679184913"><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679184913"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679184912"><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679184912"><span class="hs-identifier hs-var">sx</span></a></span></span><span> </span><span id="local-6989586621679184911"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184911"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679184910"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184910"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679184909"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184909"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679184913"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184911"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184910"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-959"></span><span>                                           </span><span class="annot"><span class="annottext">Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184909"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-960"></span><span>                                           </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679184908"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184908"><span class="hs-identifier hs-var">x'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184908"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Map k a -&gt; Map k a
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679184912"><span class="hs-identifier hs-var">sx</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184911"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184908"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184909"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-961"></span><span class="annot"><a href="Data.Map.Strict.Internal.html#updateMaxWithKey"><span class="hs-identifier hs-var">updateMaxWithKey</span></a></span><span> </span><span id="local-6989586621679184907"><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679184907"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184906"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184906"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679184905"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184905"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679184904"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184904"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679184903"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184903"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#balanceL"><span class="hs-identifier hs-var">balanceL</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184906"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184905"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184904"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(k -&gt; a -&gt; Maybe a) -&gt; Map k a -&gt; Map k a
forall k a. (k -&gt; a -&gt; Maybe a) -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#updateMaxWithKey"><span class="hs-identifier hs-var">updateMaxWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe a
</span><a href="#local-6989586621679184907"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184903"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-962"></span><span>
</span><span id="line-963"></span><span class="hs-comment">{--------------------------------------------------------------------
  Union.
--------------------------------------------------------------------}</span><span>
</span><span id="line-966"></span><span>
</span><span id="line-967"></span><span class="hs-comment">-- | The union of a list of maps, with a combining operation:</span><span>
</span><span id="line-968"></span><span class="hs-comment">--   (@'unionsWith' f == 'Prelude.foldl' ('unionWith' f) 'empty'@).</span><span>
</span><span id="line-969"></span><span class="hs-comment">--</span><span>
</span><span id="line-970"></span><span class="hs-comment">-- &gt; unionsWith (++) [(fromList [(5, &quot;a&quot;), (3, &quot;b&quot;)]), (fromList [(5, &quot;A&quot;), (7, &quot;C&quot;)]), (fromList [(5, &quot;A3&quot;), (3, &quot;B3&quot;)])]</span><span>
</span><span id="line-971"></span><span class="hs-comment">-- &gt;     == fromList [(3, &quot;bB3&quot;), (5, &quot;aAA3&quot;), (7, &quot;C&quot;)]</span><span>
</span><span id="line-972"></span><span>
</span><span id="line-973"></span><span id="local-6989586621679185742"><span id="local-6989586621679185743"><span id="local-6989586621679185744"><span class="annot"><a href="Data.Map.Strict.Internal.html#unionsWith"><span class="hs-identifier hs-type">unionsWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Foldable.html#Foldable"><span class="hs-identifier hs-type">Foldable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185744"><span class="hs-identifier hs-type">f</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185743"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185742"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621679185742"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621679185742"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185744"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185743"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185742"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185743"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185742"><span class="hs-identifier hs-type">a</span></a></span></span></span></span><span>
</span><span id="line-974"></span><span id="unionsWith"><span class="annot"><span class="annottext">unionsWith :: forall (f :: * -&gt; *) k a.
(Foldable f, Ord k) =&gt;
(a -&gt; a -&gt; a) -&gt; f (Map k a) -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#unionsWith"><span class="hs-identifier hs-var hs-var">unionsWith</span></a></span></span><span> </span><span id="local-6989586621679184898"><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679184898"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184897"><span class="annot"><span class="annottext">f (Map k a)
</span><a href="#local-6989586621679184897"><span class="hs-identifier hs-var">ts</span></a></span></span><span>
</span><span id="line-975"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Map k a -&gt; Map k a -&gt; Map k a)
-&gt; Map k a -&gt; f (Map k a) -&gt; Map k a
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">Foldable.foldl'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Ord k =&gt; (a -&gt; a -&gt; a) -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#unionWith"><span class="hs-identifier hs-var">unionWith</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679184898"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span> </span><span class="annot"><span class="annottext">f (Map k a)
</span><a href="#local-6989586621679184897"><span class="hs-identifier hs-var">ts</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#unionsWith"><span class="hs-pragma hs-type">unionsWith</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-980"></span><span class="hs-comment">{--------------------------------------------------------------------
  Union with a combining function
--------------------------------------------------------------------}</span><span>
</span><span id="line-983"></span><span class="hs-comment">-- | /O(m*log(n\/m + 1)), m &lt;= n/. Union with a combining function.</span><span>
</span><span id="line-984"></span><span class="hs-comment">--</span><span>
</span><span id="line-985"></span><span class="hs-comment">-- &gt; unionWith (++) (fromList [(5, &quot;a&quot;), (3, &quot;b&quot;)]) (fromList [(5, &quot;A&quot;), (7, &quot;C&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;aA&quot;), (7, &quot;C&quot;)]</span><span>
</span><span id="line-986"></span><span>
</span><span id="line-987"></span><span id="local-6989586621679185734"><span id="local-6989586621679185735"><span class="annot"><a href="Data.Map.Strict.Internal.html#unionWith"><span class="hs-identifier hs-type">unionWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185735"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185734"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185734"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185734"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185735"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185734"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185735"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185734"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185735"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185734"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-988"></span><span id="unionWith"><span class="annot"><span class="annottext">unionWith :: forall k a. Ord k =&gt; (a -&gt; a -&gt; a) -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#unionWith"><span class="hs-identifier hs-var hs-var">unionWith</span></a></span></span><span> </span><span id="local-6989586621679184889"><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679184889"><span class="hs-identifier hs-var">_f</span></a></span></span><span> </span><span id="local-6989586621679184888"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184888"><span class="hs-identifier hs-var">t1</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184888"><span class="hs-identifier hs-var">t1</span></a></span><span>
</span><span id="line-989"></span><span class="annot"><a href="Data.Map.Strict.Internal.html#unionWith"><span class="hs-identifier hs-var">unionWith</span></a></span><span> </span><span id="local-6989586621679184887"><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679184887"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184886"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184886"><span class="hs-identifier hs-var">t1</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184885"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184885"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679184884"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184884"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
forall k a. Ord k =&gt; (a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#insertWithR"><span class="hs-identifier hs-var">insertWithR</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679184887"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184885"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184884"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184886"><span class="hs-identifier hs-var">t1</span></a></span><span>
</span><span id="line-990"></span><span class="annot"><a href="Data.Map.Strict.Internal.html#unionWith"><span class="hs-identifier hs-var">unionWith</span></a></span><span> </span><span id="local-6989586621679184883"><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679184883"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184882"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184882"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679184881"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184881"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679184880"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184880"><span class="hs-identifier hs-var">t2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
forall k a. Ord k =&gt; (a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#insertWith"><span class="hs-identifier hs-var">insertWith</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679184883"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184882"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184881"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184880"><span class="hs-identifier hs-var">t2</span></a></span><span>
</span><span id="line-991"></span><span class="annot"><a href="Data.Map.Strict.Internal.html#unionWith"><span class="hs-identifier hs-var">unionWith</span></a></span><span> </span><span id="local-6989586621679184879"><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679184879"><span class="hs-identifier hs-var">_f</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span id="local-6989586621679184878"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184878"><span class="hs-identifier hs-var">t2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184878"><span class="hs-identifier hs-var">t2</span></a></span><span>
</span><span id="line-992"></span><span class="annot"><a href="Data.Map.Strict.Internal.html#unionWith"><span class="hs-identifier hs-var">unionWith</span></a></span><span> </span><span id="local-6989586621679184877"><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679184877"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184876"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184876"><span class="hs-identifier hs-var">k1</span></a></span></span><span> </span><span id="local-6989586621679184875"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184875"><span class="hs-identifier hs-var">x1</span></a></span></span><span> </span><span id="local-6989586621679184874"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184874"><span class="hs-identifier hs-var">l1</span></a></span></span><span> </span><span id="local-6989586621679184873"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184873"><span class="hs-identifier hs-var">r1</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679184872"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184872"><span class="hs-identifier hs-var">t2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">k -&gt; Map k a -&gt; (Map k a, Maybe a, Map k a)
forall k a. Ord k =&gt; k -&gt; Map k a -&gt; (Map k a, Maybe a, Map k a)
</span><a href="Data.Map.Internal.html#splitLookup"><span class="hs-identifier hs-var">splitLookup</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184876"><span class="hs-identifier hs-var">k1</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184872"><span class="hs-identifier hs-var">t2</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-993"></span><span>  </span><span class="hs-special">(</span><span id="local-6989586621679184871"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184871"><span class="hs-identifier hs-var">l2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184870"><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679184870"><span class="hs-identifier hs-var">mb</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184869"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184869"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184876"><span class="hs-identifier hs-var">k1</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184868"><span class="hs-identifier hs-var">x1'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Ord k =&gt; (a -&gt; a -&gt; a) -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#unionWith"><span class="hs-identifier hs-var">unionWith</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679184877"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184874"><span class="hs-identifier hs-var">l1</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184871"><span class="hs-identifier hs-var">l2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Ord k =&gt; (a -&gt; a -&gt; a) -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#unionWith"><span class="hs-identifier hs-var">unionWith</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679184877"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184873"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184869"><span class="hs-identifier hs-var">r2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-994"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679184868"><span class="annot"><span class="annottext">x1' :: a
</span><a href="#local-6989586621679184868"><span class="hs-identifier hs-var hs-var">x1'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; (a -&gt; a) -&gt; Maybe a -&gt; a
forall b a. b -&gt; (a -&gt; b) -&gt; Maybe a -&gt; b
</span><a href="../../base/src/Data.Maybe.html#maybe"><span class="hs-identifier hs-var">maybe</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184875"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679184877"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184875"><span class="hs-identifier hs-var">x1</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679184870"><span class="hs-identifier hs-var">mb</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#unionWith"><span class="hs-pragma hs-type">unionWith</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-999"></span><span class="hs-comment">-- | /O(m*log(n\/m + 1)), m &lt;= n/.</span><span>
</span><span id="line-1000"></span><span class="hs-comment">-- Union with a combining function.</span><span>
</span><span id="line-1001"></span><span class="hs-comment">--</span><span>
</span><span id="line-1002"></span><span class="hs-comment">-- &gt; let f key left_value right_value = (show key) ++ &quot;:&quot; ++ left_value ++ &quot;|&quot; ++ right_value</span><span>
</span><span id="line-1003"></span><span class="hs-comment">-- &gt; unionWithKey f (fromList [(5, &quot;a&quot;), (3, &quot;b&quot;)]) (fromList [(5, &quot;A&quot;), (7, &quot;C&quot;)]) == fromList [(3, &quot;b&quot;), (5, &quot;5:a|A&quot;), (7, &quot;C&quot;)]</span><span>
</span><span id="line-1004"></span><span>
</span><span id="line-1005"></span><span id="local-6989586621679185726"><span id="local-6989586621679185727"><span class="annot"><a href="Data.Map.Strict.Internal.html#unionWithKey"><span class="hs-identifier hs-type">unionWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185727"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185727"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185726"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185726"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185726"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185727"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185726"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185727"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185726"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185727"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185726"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-1006"></span><span id="unionWithKey"><span class="annot"><span class="annottext">unionWithKey :: forall k a.
Ord k =&gt;
(k -&gt; a -&gt; a -&gt; a) -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#unionWithKey"><span class="hs-identifier hs-var hs-var">unionWithKey</span></a></span></span><span> </span><span id="local-6989586621679184860"><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679184860"><span class="hs-identifier hs-var">_f</span></a></span></span><span> </span><span id="local-6989586621679184859"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184859"><span class="hs-identifier hs-var">t1</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184859"><span class="hs-identifier hs-var">t1</span></a></span><span>
</span><span id="line-1007"></span><span class="annot"><a href="Data.Map.Strict.Internal.html#unionWithKey"><span class="hs-identifier hs-var">unionWithKey</span></a></span><span> </span><span id="local-6989586621679184858"><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679184858"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184857"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184857"><span class="hs-identifier hs-var">t1</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184856"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184856"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679184855"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184855"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
forall k a.
Ord k =&gt;
(k -&gt; a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#insertWithKeyR"><span class="hs-identifier hs-var">insertWithKeyR</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679184858"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184856"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184855"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184857"><span class="hs-identifier hs-var">t1</span></a></span><span>
</span><span id="line-1008"></span><span class="annot"><a href="Data.Map.Strict.Internal.html#unionWithKey"><span class="hs-identifier hs-var">unionWithKey</span></a></span><span> </span><span id="local-6989586621679184854"><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679184854"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184853"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184853"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679184852"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184852"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679184851"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184851"><span class="hs-identifier hs-var">t2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
forall k a.
Ord k =&gt;
(k -&gt; a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#insertWithKey"><span class="hs-identifier hs-var">insertWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679184854"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184853"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184852"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184851"><span class="hs-identifier hs-var">t2</span></a></span><span>
</span><span id="line-1009"></span><span class="annot"><a href="Data.Map.Strict.Internal.html#unionWithKey"><span class="hs-identifier hs-var">unionWithKey</span></a></span><span> </span><span id="local-6989586621679184850"><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679184850"><span class="hs-identifier hs-var">_f</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span id="local-6989586621679184849"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184849"><span class="hs-identifier hs-var">t2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184849"><span class="hs-identifier hs-var">t2</span></a></span><span>
</span><span id="line-1010"></span><span class="annot"><a href="Data.Map.Strict.Internal.html#unionWithKey"><span class="hs-identifier hs-var">unionWithKey</span></a></span><span> </span><span id="local-6989586621679184848"><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679184848"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184847"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184847"><span class="hs-identifier hs-var">k1</span></a></span></span><span> </span><span id="local-6989586621679184846"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184846"><span class="hs-identifier hs-var">x1</span></a></span></span><span> </span><span id="local-6989586621679184845"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184845"><span class="hs-identifier hs-var">l1</span></a></span></span><span> </span><span id="local-6989586621679184844"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184844"><span class="hs-identifier hs-var">r1</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679184843"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184843"><span class="hs-identifier hs-var">t2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">k -&gt; Map k a -&gt; (Map k a, Maybe a, Map k a)
forall k a. Ord k =&gt; k -&gt; Map k a -&gt; (Map k a, Maybe a, Map k a)
</span><a href="Data.Map.Internal.html#splitLookup"><span class="hs-identifier hs-var">splitLookup</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184847"><span class="hs-identifier hs-var">k1</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184843"><span class="hs-identifier hs-var">t2</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1011"></span><span>  </span><span class="hs-special">(</span><span id="local-6989586621679184842"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184842"><span class="hs-identifier hs-var">l2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184841"><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679184841"><span class="hs-identifier hs-var">mb</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184840"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184840"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184847"><span class="hs-identifier hs-var">k1</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184839"><span class="hs-identifier hs-var">x1'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(k -&gt; a -&gt; a -&gt; a) -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a.
Ord k =&gt;
(k -&gt; a -&gt; a -&gt; a) -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#unionWithKey"><span class="hs-identifier hs-var">unionWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679184848"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184845"><span class="hs-identifier hs-var">l1</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184842"><span class="hs-identifier hs-var">l2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(k -&gt; a -&gt; a -&gt; a) -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a.
Ord k =&gt;
(k -&gt; a -&gt; a -&gt; a) -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#unionWithKey"><span class="hs-identifier hs-var">unionWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679184848"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184844"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184840"><span class="hs-identifier hs-var">r2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1012"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679184839"><span class="annot"><span class="annottext">x1' :: a
</span><a href="#local-6989586621679184839"><span class="hs-identifier hs-var hs-var">x1'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; (a -&gt; a) -&gt; Maybe a -&gt; a
forall b a. b -&gt; (a -&gt; b) -&gt; Maybe a -&gt; b
</span><a href="../../base/src/Data.Maybe.html#maybe"><span class="hs-identifier hs-var">maybe</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184846"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679184848"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184847"><span class="hs-identifier hs-var">k1</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184846"><span class="hs-identifier hs-var">x1</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679184841"><span class="hs-identifier hs-var">mb</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#unionWithKey"><span class="hs-pragma hs-type">unionWithKey</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1017"></span><span class="hs-comment">{--------------------------------------------------------------------
  Difference
--------------------------------------------------------------------}</span><span>
</span><span id="line-1020"></span><span>
</span><span id="line-1021"></span><span class="hs-comment">-- | /O(n+m)/. Difference with a combining function.</span><span>
</span><span id="line-1022"></span><span class="hs-comment">-- When two equal keys are</span><span>
</span><span id="line-1023"></span><span class="hs-comment">-- encountered, the combining function is applied to the values of these keys.</span><span>
</span><span id="line-1024"></span><span class="hs-comment">-- If it returns 'Nothing', the element is discarded (proper set difference). If</span><span>
</span><span id="line-1025"></span><span class="hs-comment">-- it returns (@'Just' y@), the element is updated with a new value @y@.</span><span>
</span><span id="line-1026"></span><span class="hs-comment">--</span><span>
</span><span id="line-1027"></span><span class="hs-comment">-- &gt; let f al ar = if al == &quot;b&quot; then Just (al ++ &quot;:&quot; ++ ar) else Nothing</span><span>
</span><span id="line-1028"></span><span class="hs-comment">-- &gt; differenceWith f (fromList [(5, &quot;a&quot;), (3, &quot;b&quot;)]) (fromList [(5, &quot;A&quot;), (3, &quot;B&quot;), (7, &quot;C&quot;)])</span><span>
</span><span id="line-1029"></span><span class="hs-comment">-- &gt;     == singleton 3 &quot;b:B&quot;</span><span>
</span><span id="line-1030"></span><span>
</span><span id="line-1031"></span><span id="local-6989586621679185721"><span id="local-6989586621679185722"><span id="local-6989586621679185723"><span class="annot"><a href="Data.Map.Strict.Internal.html#differenceWith"><span class="hs-identifier hs-type">differenceWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185723"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185722"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185721"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185722"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185723"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185722"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185723"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185721"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185723"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185722"><span class="hs-identifier hs-type">a</span></a></span></span></span></span><span>
</span><span id="line-1032"></span><span id="differenceWith"><span class="annot"><span class="annottext">differenceWith :: forall k a b.
Ord k =&gt;
(a -&gt; b -&gt; Maybe a) -&gt; Map k a -&gt; Map k b -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#differenceWith"><span class="hs-identifier hs-var hs-var">differenceWith</span></a></span></span><span> </span><span id="local-6989586621679184832"><span class="annot"><span class="annottext">a -&gt; b -&gt; Maybe a
</span><a href="#local-6989586621679184832"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleWhenMissing k a a
-&gt; SimpleWhenMissing k b a
-&gt; SimpleWhenMatched k a b a
-&gt; Map k a
-&gt; Map k b
-&gt; Map k a
forall k a c b.
Ord k =&gt;
SimpleWhenMissing k a c
-&gt; SimpleWhenMissing k b c
-&gt; SimpleWhenMatched k a b c
-&gt; Map k a
-&gt; Map k b
-&gt; Map k c
</span><a href="Data.Map.Internal.html#merge"><span class="hs-identifier hs-var">merge</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleWhenMissing k a a
forall (f :: * -&gt; *) k x. Applicative f =&gt; WhenMissing f k x x
</span><a href="Data.Map.Internal.html#preserveMissing"><span class="hs-identifier hs-var">preserveMissing</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleWhenMissing k b a
forall (f :: * -&gt; *) k x y. Applicative f =&gt; WhenMissing f k x y
</span><a href="Data.Map.Internal.html#dropMissing"><span class="hs-identifier hs-var">dropMissing</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(k -&gt; a -&gt; b -&gt; Maybe a) -&gt; SimpleWhenMatched k a b a
forall (f :: * -&gt; *) k x y z.
Applicative f =&gt;
(k -&gt; x -&gt; y -&gt; Maybe z) -&gt; WhenMatched f k x y z
</span><a href="Data.Map.Strict.Internal.html#zipWithMaybeMatched"><span class="hs-identifier hs-var">zipWithMaybeMatched</span></a></span><span> </span><span class="annot"><span class="annottext">((k -&gt; a -&gt; b -&gt; Maybe a) -&gt; SimpleWhenMatched k a b a)
-&gt; (k -&gt; a -&gt; b -&gt; Maybe a) -&gt; SimpleWhenMatched k a b a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">k
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184831"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184831"><span class="hs-identifier hs-var">x1</span></a></span></span><span> </span><span id="local-6989586621679184830"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679184830"><span class="hs-identifier hs-var">x2</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; Maybe a
</span><a href="#local-6989586621679184832"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184831"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679184830"><span class="hs-identifier hs-var">x2</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#differenceWith"><span class="hs-pragma hs-type">differenceWith</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1037"></span><span class="hs-comment">-- | /O(n+m)/. Difference with a combining function. When two equal keys are</span><span>
</span><span id="line-1038"></span><span class="hs-comment">-- encountered, the combining function is applied to the key and both values.</span><span>
</span><span id="line-1039"></span><span class="hs-comment">-- If it returns 'Nothing', the element is discarded (proper set difference). If</span><span>
</span><span id="line-1040"></span><span class="hs-comment">-- it returns (@'Just' y@), the element is updated with a new value @y@.</span><span>
</span><span id="line-1041"></span><span class="hs-comment">--</span><span>
</span><span id="line-1042"></span><span class="hs-comment">-- &gt; let f k al ar = if al == &quot;b&quot; then Just ((show k) ++ &quot;:&quot; ++ al ++ &quot;|&quot; ++ ar) else Nothing</span><span>
</span><span id="line-1043"></span><span class="hs-comment">-- &gt; differenceWithKey f (fromList [(5, &quot;a&quot;), (3, &quot;b&quot;)]) (fromList [(5, &quot;A&quot;), (3, &quot;B&quot;), (10, &quot;C&quot;)])</span><span>
</span><span id="line-1044"></span><span class="hs-comment">-- &gt;     == singleton 3 &quot;3:b|B&quot;</span><span>
</span><span id="line-1045"></span><span>
</span><span id="line-1046"></span><span id="local-6989586621679185695"><span id="local-6989586621679185696"><span id="local-6989586621679185697"><span class="annot"><a href="Data.Map.Strict.Internal.html#differenceWithKey"><span class="hs-identifier hs-type">differenceWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185697"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185697"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185696"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185695"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185696"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185697"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185696"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185697"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185695"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185697"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185696"><span class="hs-identifier hs-type">a</span></a></span></span></span></span><span>
</span><span id="line-1047"></span><span id="differenceWithKey"><span class="annot"><span class="annottext">differenceWithKey :: forall k a b.
Ord k =&gt;
(k -&gt; a -&gt; b -&gt; Maybe a) -&gt; Map k a -&gt; Map k b -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#differenceWithKey"><span class="hs-identifier hs-var hs-var">differenceWithKey</span></a></span></span><span> </span><span id="local-6989586621679184824"><span class="annot"><span class="annottext">k -&gt; a -&gt; b -&gt; Maybe a
</span><a href="#local-6989586621679184824"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleWhenMissing k a a
-&gt; SimpleWhenMissing k b a
-&gt; SimpleWhenMatched k a b a
-&gt; Map k a
-&gt; Map k b
-&gt; Map k a
forall k a c b.
Ord k =&gt;
SimpleWhenMissing k a c
-&gt; SimpleWhenMissing k b c
-&gt; SimpleWhenMatched k a b c
-&gt; Map k a
-&gt; Map k b
-&gt; Map k c
</span><a href="Data.Map.Internal.html#merge"><span class="hs-identifier hs-var">merge</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleWhenMissing k a a
forall (f :: * -&gt; *) k x. Applicative f =&gt; WhenMissing f k x x
</span><a href="Data.Map.Internal.html#preserveMissing"><span class="hs-identifier hs-var">preserveMissing</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleWhenMissing k b a
forall (f :: * -&gt; *) k x y. Applicative f =&gt; WhenMissing f k x y
</span><a href="Data.Map.Internal.html#dropMissing"><span class="hs-identifier hs-var">dropMissing</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(k -&gt; a -&gt; b -&gt; Maybe a) -&gt; SimpleWhenMatched k a b a
forall (f :: * -&gt; *) k x y z.
Applicative f =&gt;
(k -&gt; x -&gt; y -&gt; Maybe z) -&gt; WhenMatched f k x y z
</span><a href="Data.Map.Strict.Internal.html#zipWithMaybeMatched"><span class="hs-identifier hs-var">zipWithMaybeMatched</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; b -&gt; Maybe a
</span><a href="#local-6989586621679184824"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#differenceWithKey"><span class="hs-pragma hs-type">differenceWithKey</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1052"></span><span>
</span><span id="line-1053"></span><span class="hs-comment">{--------------------------------------------------------------------
  Intersection
--------------------------------------------------------------------}</span><span>
</span><span id="line-1056"></span><span>
</span><span id="line-1057"></span><span class="hs-comment">-- | /O(m*log(n\/m + 1)), m &lt;= n/. Intersection with a combining function.</span><span>
</span><span id="line-1058"></span><span class="hs-comment">--</span><span>
</span><span id="line-1059"></span><span class="hs-comment">-- &gt; intersectionWith (++) (fromList [(5, &quot;a&quot;), (3, &quot;b&quot;)]) (fromList [(5, &quot;A&quot;), (7, &quot;C&quot;)]) == singleton 5 &quot;aA&quot;</span><span>
</span><span id="line-1060"></span><span>
</span><span id="line-1061"></span><span id="local-6989586621679185688"><span id="local-6989586621679185689"><span id="local-6989586621679185690"><span id="local-6989586621679185691"><span class="annot"><a href="Data.Map.Strict.Internal.html#intersectionWith"><span class="hs-identifier hs-type">intersectionWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185691"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185690"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185689"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185688"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185691"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185690"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185691"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185689"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185691"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185688"><span class="hs-identifier hs-type">c</span></a></span></span></span></span></span><span>
</span><span id="line-1062"></span><span id="intersectionWith"><span class="annot"><span class="annottext">intersectionWith :: forall k a b c.
Ord k =&gt;
(a -&gt; b -&gt; c) -&gt; Map k a -&gt; Map k b -&gt; Map k c
</span><a href="Data.Map.Strict.Internal.html#intersectionWith"><span class="hs-identifier hs-var hs-var">intersectionWith</span></a></span></span><span> </span><span id="local-6989586621679184822"><span class="annot"><span class="annottext">a -&gt; b -&gt; c
</span><a href="#local-6989586621679184822"><span class="hs-identifier hs-var">_f</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Map k b
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k c
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1063"></span><span class="annot"><a href="Data.Map.Strict.Internal.html#intersectionWith"><span class="hs-identifier hs-var">intersectionWith</span></a></span><span> </span><span id="local-6989586621679184821"><span class="annot"><span class="annottext">a -&gt; b -&gt; c
</span><a href="#local-6989586621679184821"><span class="hs-identifier hs-var">_f</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Map k b
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k c
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1064"></span><span class="annot"><a href="Data.Map.Strict.Internal.html#intersectionWith"><span class="hs-identifier hs-var">intersectionWith</span></a></span><span> </span><span id="local-6989586621679184820"><span class="annot"><span class="annottext">a -&gt; b -&gt; c
</span><a href="#local-6989586621679184820"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184819"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184819"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679184818"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184818"><span class="hs-identifier hs-var">x1</span></a></span></span><span> </span><span id="local-6989586621679184817"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184817"><span class="hs-identifier hs-var">l1</span></a></span></span><span> </span><span id="local-6989586621679184816"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184816"><span class="hs-identifier hs-var">r1</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679184815"><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184815"><span class="hs-identifier hs-var">t2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe b
</span><a href="#local-6989586621679184814"><span class="hs-identifier hs-var">mb</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1065"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679184813"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679184813"><span class="hs-identifier hs-var">x2</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679184812"><span class="annot"><span class="annottext">x1' :: c
</span><a href="#local-6989586621679184812"><span class="hs-identifier hs-var hs-var">x1'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; c
</span><a href="#local-6989586621679184820"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184818"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679184813"><span class="hs-identifier hs-var">x2</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">k -&gt; c -&gt; Map k c -&gt; Map k c -&gt; Map k c
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184819"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679184812"><span class="hs-identifier hs-var">x1'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k c
</span><a href="#local-6989586621679184811"><span class="hs-identifier hs-var">l1l2</span></a></span><span> </span><span class="annot"><span class="annottext">Map k c
</span><a href="#local-6989586621679184810"><span class="hs-identifier hs-var">r1r2</span></a></span><span>
</span><span id="line-1066"></span><span>    </span><span class="annot"><span class="annottext">Maybe b
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Map k c -&gt; Map k c -&gt; Map k c
forall k a. Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#link2"><span class="hs-identifier hs-var">link2</span></a></span><span> </span><span class="annot"><span class="annottext">Map k c
</span><a href="#local-6989586621679184811"><span class="hs-identifier hs-var">l1l2</span></a></span><span> </span><span class="annot"><span class="annottext">Map k c
</span><a href="#local-6989586621679184810"><span class="hs-identifier hs-var">r1r2</span></a></span><span>
</span><span id="line-1067"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1068"></span><span>    </span><span class="hs-glyph">!</span><span class="hs-special">(</span><span id="local-6989586621679184808"><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184808"><span class="hs-identifier hs-var">l2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184814"><span class="annot"><span class="annottext">Maybe b
</span><a href="#local-6989586621679184814"><span class="hs-identifier hs-var">mb</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184807"><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184807"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; Map k b -&gt; (Map k b, Maybe b, Map k b)
forall k a. Ord k =&gt; k -&gt; Map k a -&gt; (Map k a, Maybe a, Map k a)
</span><a href="Data.Map.Internal.html#splitLookup"><span class="hs-identifier hs-var">splitLookup</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184819"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184815"><span class="hs-identifier hs-var">t2</span></a></span><span>
</span><span id="line-1069"></span><span>    </span><span class="hs-glyph">!</span><span id="local-6989586621679184811"><span class="annot"><span class="annottext">l1l2 :: Map k c
</span><a href="#local-6989586621679184811"><span class="hs-identifier hs-var hs-var">l1l2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; c) -&gt; Map k a -&gt; Map k b -&gt; Map k c
forall k a b c.
Ord k =&gt;
(a -&gt; b -&gt; c) -&gt; Map k a -&gt; Map k b -&gt; Map k c
</span><a href="Data.Map.Strict.Internal.html#intersectionWith"><span class="hs-identifier hs-var">intersectionWith</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; c
</span><a href="#local-6989586621679184820"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184817"><span class="hs-identifier hs-var">l1</span></a></span><span> </span><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184808"><span class="hs-identifier hs-var">l2</span></a></span><span>
</span><span id="line-1070"></span><span>    </span><span class="hs-glyph">!</span><span id="local-6989586621679184810"><span class="annot"><span class="annottext">r1r2 :: Map k c
</span><a href="#local-6989586621679184810"><span class="hs-identifier hs-var hs-var">r1r2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; c) -&gt; Map k a -&gt; Map k b -&gt; Map k c
forall k a b c.
Ord k =&gt;
(a -&gt; b -&gt; c) -&gt; Map k a -&gt; Map k b -&gt; Map k c
</span><a href="Data.Map.Strict.Internal.html#intersectionWith"><span class="hs-identifier hs-var">intersectionWith</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; c
</span><a href="#local-6989586621679184820"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184816"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184807"><span class="hs-identifier hs-var">r2</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#intersectionWith"><span class="hs-pragma hs-type">intersectionWith</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1075"></span><span class="hs-comment">-- | /O(m*log(n\/m + 1)), m &lt;= n/. Intersection with a combining function.</span><span>
</span><span id="line-1076"></span><span class="hs-comment">--</span><span>
</span><span id="line-1077"></span><span class="hs-comment">-- &gt; let f k al ar = (show k) ++ &quot;:&quot; ++ al ++ &quot;|&quot; ++ ar</span><span>
</span><span id="line-1078"></span><span class="hs-comment">-- &gt; intersectionWithKey f (fromList [(5, &quot;a&quot;), (3, &quot;b&quot;)]) (fromList [(5, &quot;A&quot;), (7, &quot;C&quot;)]) == singleton 5 &quot;5:a|A&quot;</span><span>
</span><span id="line-1079"></span><span>
</span><span id="line-1080"></span><span id="local-6989586621679185680"><span id="local-6989586621679185681"><span id="local-6989586621679185682"><span id="local-6989586621679185683"><span class="annot"><a href="Data.Map.Strict.Internal.html#intersectionWithKey"><span class="hs-identifier hs-type">intersectionWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185683"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185683"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185682"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185681"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185680"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185683"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185682"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185683"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185681"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185683"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185680"><span class="hs-identifier hs-type">c</span></a></span></span></span></span></span><span>
</span><span id="line-1081"></span><span id="intersectionWithKey"><span class="annot"><span class="annottext">intersectionWithKey :: forall k a b c.
Ord k =&gt;
(k -&gt; a -&gt; b -&gt; c) -&gt; Map k a -&gt; Map k b -&gt; Map k c
</span><a href="Data.Map.Strict.Internal.html#intersectionWithKey"><span class="hs-identifier hs-var hs-var">intersectionWithKey</span></a></span></span><span> </span><span id="local-6989586621679184803"><span class="annot"><span class="annottext">k -&gt; a -&gt; b -&gt; c
</span><a href="#local-6989586621679184803"><span class="hs-identifier hs-var">_f</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Map k b
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k c
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1082"></span><span class="annot"><a href="Data.Map.Strict.Internal.html#intersectionWithKey"><span class="hs-identifier hs-var">intersectionWithKey</span></a></span><span> </span><span id="local-6989586621679184802"><span class="annot"><span class="annottext">k -&gt; a -&gt; b -&gt; c
</span><a href="#local-6989586621679184802"><span class="hs-identifier hs-var">_f</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Map k b
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k c
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1083"></span><span class="annot"><a href="Data.Map.Strict.Internal.html#intersectionWithKey"><span class="hs-identifier hs-var">intersectionWithKey</span></a></span><span> </span><span id="local-6989586621679184801"><span class="annot"><span class="annottext">k -&gt; a -&gt; b -&gt; c
</span><a href="#local-6989586621679184801"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184800"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184800"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679184799"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184799"><span class="hs-identifier hs-var">x1</span></a></span></span><span> </span><span id="local-6989586621679184798"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184798"><span class="hs-identifier hs-var">l1</span></a></span></span><span> </span><span id="local-6989586621679184797"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184797"><span class="hs-identifier hs-var">r1</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679184796"><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184796"><span class="hs-identifier hs-var">t2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe b
</span><a href="#local-6989586621679184795"><span class="hs-identifier hs-var">mb</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1084"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679184794"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679184794"><span class="hs-identifier hs-var">x2</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679184793"><span class="annot"><span class="annottext">x1' :: c
</span><a href="#local-6989586621679184793"><span class="hs-identifier hs-var hs-var">x1'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; b -&gt; c
</span><a href="#local-6989586621679184801"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184800"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184799"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679184794"><span class="hs-identifier hs-var">x2</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">k -&gt; c -&gt; Map k c -&gt; Map k c -&gt; Map k c
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184800"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679184793"><span class="hs-identifier hs-var">x1'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k c
</span><a href="#local-6989586621679184792"><span class="hs-identifier hs-var">l1l2</span></a></span><span> </span><span class="annot"><span class="annottext">Map k c
</span><a href="#local-6989586621679184791"><span class="hs-identifier hs-var">r1r2</span></a></span><span>
</span><span id="line-1085"></span><span>    </span><span class="annot"><span class="annottext">Maybe b
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Map k c -&gt; Map k c -&gt; Map k c
forall k a. Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#link2"><span class="hs-identifier hs-var">link2</span></a></span><span> </span><span class="annot"><span class="annottext">Map k c
</span><a href="#local-6989586621679184792"><span class="hs-identifier hs-var">l1l2</span></a></span><span> </span><span class="annot"><span class="annottext">Map k c
</span><a href="#local-6989586621679184791"><span class="hs-identifier hs-var">r1r2</span></a></span><span>
</span><span id="line-1086"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1087"></span><span>    </span><span class="hs-glyph">!</span><span class="hs-special">(</span><span id="local-6989586621679184789"><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184789"><span class="hs-identifier hs-var">l2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184795"><span class="annot"><span class="annottext">Maybe b
</span><a href="#local-6989586621679184795"><span class="hs-identifier hs-var">mb</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184788"><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184788"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; Map k b -&gt; (Map k b, Maybe b, Map k b)
forall k a. Ord k =&gt; k -&gt; Map k a -&gt; (Map k a, Maybe a, Map k a)
</span><a href="Data.Map.Internal.html#splitLookup"><span class="hs-identifier hs-var">splitLookup</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184800"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184796"><span class="hs-identifier hs-var">t2</span></a></span><span>
</span><span id="line-1088"></span><span>    </span><span class="hs-glyph">!</span><span id="local-6989586621679184792"><span class="annot"><span class="annottext">l1l2 :: Map k c
</span><a href="#local-6989586621679184792"><span class="hs-identifier hs-var hs-var">l1l2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; a -&gt; b -&gt; c) -&gt; Map k a -&gt; Map k b -&gt; Map k c
forall k a b c.
Ord k =&gt;
(k -&gt; a -&gt; b -&gt; c) -&gt; Map k a -&gt; Map k b -&gt; Map k c
</span><a href="Data.Map.Strict.Internal.html#intersectionWithKey"><span class="hs-identifier hs-var">intersectionWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; b -&gt; c
</span><a href="#local-6989586621679184801"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184798"><span class="hs-identifier hs-var">l1</span></a></span><span> </span><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184789"><span class="hs-identifier hs-var">l2</span></a></span><span>
</span><span id="line-1089"></span><span>    </span><span class="hs-glyph">!</span><span id="local-6989586621679184791"><span class="annot"><span class="annottext">r1r2 :: Map k c
</span><a href="#local-6989586621679184791"><span class="hs-identifier hs-var hs-var">r1r2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; a -&gt; b -&gt; c) -&gt; Map k a -&gt; Map k b -&gt; Map k c
forall k a b c.
Ord k =&gt;
(k -&gt; a -&gt; b -&gt; c) -&gt; Map k a -&gt; Map k b -&gt; Map k c
</span><a href="Data.Map.Strict.Internal.html#intersectionWithKey"><span class="hs-identifier hs-var">intersectionWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; b -&gt; c
</span><a href="#local-6989586621679184801"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184797"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184788"><span class="hs-identifier hs-var">r2</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#intersectionWithKey"><span class="hs-pragma hs-type">intersectionWithKey</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1094"></span><span class="hs-comment">-- | Map covariantly over a @'WhenMissing' f k x@.</span><span>
</span><span id="line-1095"></span><span id="local-6989586621679185671"><span id="local-6989586621679185672"><span id="local-6989586621679185673"><span id="local-6989586621679185674"><span id="local-6989586621679185675"><span class="annot"><a href="Data.Map.Strict.Internal.html#mapWhenMissing"><span class="hs-identifier hs-type">mapWhenMissing</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185675"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185674"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185673"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#WhenMissing"><span class="hs-identifier hs-type">WhenMissing</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185675"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185672"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185671"><span class="hs-identifier hs-type">x</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185674"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#WhenMissing"><span class="hs-identifier hs-type">WhenMissing</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185675"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185672"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185671"><span class="hs-identifier hs-type">x</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185673"><span class="hs-identifier hs-type">b</span></a></span></span></span></span></span></span><span>
</span><span id="line-1096"></span><span id="mapWhenMissing"><span class="annot"><span class="annottext">mapWhenMissing :: forall (f :: * -&gt; *) a b k x.
Functor f =&gt;
(a -&gt; b) -&gt; WhenMissing f k x a -&gt; WhenMissing f k x b
</span><a href="Data.Map.Strict.Internal.html#mapWhenMissing"><span class="hs-identifier hs-var hs-var">mapWhenMissing</span></a></span></span><span> </span><span id="local-6989586621679184780"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679184780"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184779"><span class="annot"><span class="annottext">WhenMissing f k x a
</span><a href="#local-6989586621679184779"><span class="hs-identifier hs-var">q</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WhenMissing :: forall (f :: * -&gt; *) k x y.
(Map k x -&gt; f (Map k y))
-&gt; (k -&gt; x -&gt; f (Maybe y)) -&gt; WhenMissing f k x y
</span><a href="Data.Map.Internal.html#WhenMissing"><span class="hs-identifier hs-type">WhenMissing</span></a></span><span>
</span><span id="line-1097"></span><span>  </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">missingSubtree :: Map k x -&gt; f (Map k b)
</span><a href="Data.Map.Internal.html#missingSubtree"><span class="hs-identifier hs-var">missingSubtree</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Map k a -&gt; Map k b) -&gt; f (Map k a) -&gt; f (Map k b)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; Map k a -&gt; Map k b
forall a b k. (a -&gt; b) -&gt; Map k a -&gt; Map k b
</span><a href="Data.Map.Strict.Internal.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679184780"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(f (Map k a) -&gt; f (Map k b))
-&gt; (Map k x -&gt; f (Map k a)) -&gt; Map k x -&gt; f (Map k b)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">WhenMissing f k x a -&gt; Map k x -&gt; f (Map k a)
forall (f :: * -&gt; *) k x y.
WhenMissing f k x y -&gt; Map k x -&gt; f (Map k y)
</span><a href="Data.Map.Internal.html#missingSubtree"><span class="hs-identifier hs-var hs-var">missingSubtree</span></a></span><span> </span><span class="annot"><span class="annottext">WhenMissing f k x a
</span><a href="#local-6989586621679184779"><span class="hs-identifier hs-var">q</span></a></span><span>
</span><span id="line-1098"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">missingKey :: k -&gt; x -&gt; f (Maybe b)
</span><a href="Data.Map.Internal.html#missingKey"><span class="hs-identifier hs-var">missingKey</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679184775"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184775"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679184774"><span class="annot"><span class="annottext">x
</span><a href="#local-6989586621679184774"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Maybe a -&gt; Maybe b) -&gt; f (Maybe a) -&gt; f (Maybe b)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe b -&gt; Maybe b
forall a. Maybe a -&gt; Maybe a
</span><a href="Data.Map.Strict.Internal.html#forceMaybe"><span class="hs-identifier hs-var">forceMaybe</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe b -&gt; Maybe b) -&gt; (Maybe a -&gt; Maybe b) -&gt; Maybe a -&gt; Maybe b
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; Maybe a -&gt; Maybe b
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679184780"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(f (Maybe a) -&gt; f (Maybe b)) -&gt; f (Maybe a) -&gt; f (Maybe b)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">WhenMissing f k x a -&gt; k -&gt; x -&gt; f (Maybe a)
forall (f :: * -&gt; *) k x y.
WhenMissing f k x y -&gt; k -&gt; x -&gt; f (Maybe y)
</span><a href="Data.Map.Internal.html#missingKey"><span class="hs-identifier hs-var hs-var">missingKey</span></a></span><span> </span><span class="annot"><span class="annottext">WhenMissing f k x a
</span><a href="#local-6989586621679184779"><span class="hs-identifier hs-var">q</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184775"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">x
</span><a href="#local-6989586621679184774"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">}</span><span>
</span><span id="line-1099"></span><span>
</span><span id="line-1100"></span><span class="hs-comment">-- | Map covariantly over a @'WhenMatched' f k x y@.</span><span>
</span><span id="line-1101"></span><span id="local-6989586621679185646"><span id="local-6989586621679185647"><span id="local-6989586621679185648"><span id="local-6989586621679185649"><span id="local-6989586621679185650"><span id="local-6989586621679185651"><span class="annot"><a href="Data.Map.Strict.Internal.html#mapWhenMatched"><span class="hs-identifier hs-type">mapWhenMatched</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185651"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185650"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185649"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#WhenMatched"><span class="hs-identifier hs-type">WhenMatched</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185651"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185648"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185647"><span class="hs-identifier hs-type">x</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185646"><span class="hs-identifier hs-type">y</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185650"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#WhenMatched"><span class="hs-identifier hs-type">WhenMatched</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185651"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185648"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185647"><span class="hs-identifier hs-type">x</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185646"><span class="hs-identifier hs-type">y</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185649"><span class="hs-identifier hs-type">b</span></a></span></span></span></span></span></span></span><span>
</span><span id="line-1102"></span><span id="mapWhenMatched"><span class="annot"><span class="annottext">mapWhenMatched :: forall (f :: * -&gt; *) a b k x y.
Functor f =&gt;
(a -&gt; b) -&gt; WhenMatched f k x y a -&gt; WhenMatched f k x y b
</span><a href="Data.Map.Strict.Internal.html#mapWhenMatched"><span class="hs-identifier hs-var hs-var">mapWhenMatched</span></a></span></span><span> </span><span id="local-6989586621679184769"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679184769"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184768"><span class="annot"><span class="annottext">WhenMatched f k x y a
</span><a href="#local-6989586621679184768"><span class="hs-identifier hs-var">q</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WhenMatched :: forall (f :: * -&gt; *) k x y z.
(k -&gt; x -&gt; y -&gt; f (Maybe z)) -&gt; WhenMatched f k x y z
</span><a href="Data.Map.Internal.html#WhenMatched"><span class="hs-identifier hs-type">WhenMatched</span></a></span><span>
</span><span id="line-1103"></span><span>  </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">matchedKey :: k -&gt; x -&gt; y -&gt; f (Maybe b)
</span><a href="Data.Map.Internal.html#matchedKey"><span class="hs-identifier hs-var">matchedKey</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679184765"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184765"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679184764"><span class="annot"><span class="annottext">x
</span><a href="#local-6989586621679184764"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679184763"><span class="annot"><span class="annottext">y
</span><a href="#local-6989586621679184763"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Maybe a -&gt; Maybe b) -&gt; f (Maybe a) -&gt; f (Maybe b)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe b -&gt; Maybe b
forall a. Maybe a -&gt; Maybe a
</span><a href="Data.Map.Strict.Internal.html#forceMaybe"><span class="hs-identifier hs-var">forceMaybe</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe b -&gt; Maybe b) -&gt; (Maybe a -&gt; Maybe b) -&gt; Maybe a -&gt; Maybe b
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; Maybe a -&gt; Maybe b
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679184769"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(f (Maybe a) -&gt; f (Maybe b)) -&gt; f (Maybe a) -&gt; f (Maybe b)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">WhenMatched f k x y a -&gt; k -&gt; x -&gt; y -&gt; f (Maybe a)
forall (f :: * -&gt; *) k x y z.
WhenMatched f k x y z -&gt; k -&gt; x -&gt; y -&gt; f (Maybe z)
</span><a href="Data.Map.Internal.html#runWhenMatched"><span class="hs-identifier hs-var">runWhenMatched</span></a></span><span> </span><span class="annot"><span class="annottext">WhenMatched f k x y a
</span><a href="#local-6989586621679184768"><span class="hs-identifier hs-var">q</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184765"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">x
</span><a href="#local-6989586621679184764"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">y
</span><a href="#local-6989586621679184763"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1104"></span><span>
</span><span id="line-1105"></span><span class="hs-comment">-- | When a key is found in both maps, apply a function to the</span><span>
</span><span id="line-1106"></span><span class="hs-comment">-- key and values and maybe use the result in the merged map.</span><span>
</span><span id="line-1107"></span><span class="hs-comment">--</span><span>
</span><span id="line-1108"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1109"></span><span class="hs-comment">-- zipWithMaybeMatched :: (k -&gt; x -&gt; y -&gt; Maybe z)</span><span>
</span><span id="line-1110"></span><span class="hs-comment">--                     -&gt; SimpleWhenMatched k x y z</span><span>
</span><span id="line-1111"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1112"></span><span id="local-6989586621679185699"><span id="local-6989586621679185700"><span id="local-6989586621679185701"><span id="local-6989586621679185702"><span id="local-6989586621679185703"><span class="annot"><a href="Data.Map.Strict.Internal.html#zipWithMaybeMatched"><span class="hs-identifier hs-type">zipWithMaybeMatched</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier hs-type">Applicative</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185703"><span class="hs-identifier hs-type">f</span></a></span><span>
</span><span id="line-1113"></span><span>                    </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185702"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185701"><span class="hs-identifier hs-type">x</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185700"><span class="hs-identifier hs-type">y</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185699"><span class="hs-identifier hs-type">z</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1114"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#WhenMatched"><span class="hs-identifier hs-type">WhenMatched</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185703"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185702"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185701"><span class="hs-identifier hs-type">x</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185700"><span class="hs-identifier hs-type">y</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185699"><span class="hs-identifier hs-type">z</span></a></span></span></span></span></span></span><span>
</span><span id="line-1115"></span><span id="zipWithMaybeMatched"><span class="annot"><span class="annottext">zipWithMaybeMatched :: forall (f :: * -&gt; *) k x y z.
Applicative f =&gt;
(k -&gt; x -&gt; y -&gt; Maybe z) -&gt; WhenMatched f k x y z
</span><a href="Data.Map.Strict.Internal.html#zipWithMaybeMatched"><span class="hs-identifier hs-var hs-var">zipWithMaybeMatched</span></a></span></span><span> </span><span id="local-6989586621679184760"><span class="annot"><span class="annottext">k -&gt; x -&gt; y -&gt; Maybe z
</span><a href="#local-6989586621679184760"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; x -&gt; y -&gt; f (Maybe z)) -&gt; WhenMatched f k x y z
forall (f :: * -&gt; *) k x y z.
(k -&gt; x -&gt; y -&gt; f (Maybe z)) -&gt; WhenMatched f k x y z
</span><a href="Data.Map.Internal.html#WhenMatched"><span class="hs-identifier hs-var">WhenMatched</span></a></span><span> </span><span class="annot"><span class="annottext">((k -&gt; x -&gt; y -&gt; f (Maybe z)) -&gt; WhenMatched f k x y z)
-&gt; (k -&gt; x -&gt; y -&gt; f (Maybe z)) -&gt; WhenMatched f k x y z
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1116"></span><span>  </span><span class="hs-glyph">\</span><span id="local-6989586621679184759"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184759"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679184758"><span class="annot"><span class="annottext">x
</span><a href="#local-6989586621679184758"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679184757"><span class="annot"><span class="annottext">y
</span><a href="#local-6989586621679184757"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe z -&gt; f (Maybe z)
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe z -&gt; f (Maybe z)) -&gt; Maybe z -&gt; f (Maybe z)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe z -&gt; Maybe z
forall a. Maybe a -&gt; Maybe a
</span><a href="Data.Map.Strict.Internal.html#forceMaybe"><span class="hs-identifier hs-var">forceMaybe</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe z -&gt; Maybe z) -&gt; Maybe z -&gt; Maybe z
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; x -&gt; y -&gt; Maybe z
</span><a href="#local-6989586621679184760"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184759"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">x
</span><a href="#local-6989586621679184758"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">y
</span><a href="#local-6989586621679184757"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-1117"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#zipWithMaybeMatched"><span class="hs-pragma hs-type">zipWithMaybeMatched</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1118"></span><span>
</span><span id="line-1119"></span><span class="hs-comment">-- | When a key is found in both maps, apply a function to the</span><span>
</span><span id="line-1120"></span><span class="hs-comment">-- key and values, perform the resulting action, and maybe use</span><span>
</span><span id="line-1121"></span><span class="hs-comment">-- the result in the merged map.</span><span>
</span><span id="line-1122"></span><span class="hs-comment">--</span><span>
</span><span id="line-1123"></span><span class="hs-comment">-- This is the fundamental 'WhenMatched' tactic.</span><span>
</span><span id="line-1124"></span><span id="local-6989586621679185618"><span id="local-6989586621679185619"><span id="local-6989586621679185620"><span id="local-6989586621679185621"><span id="local-6989586621679185622"><span class="annot"><a href="Data.Map.Strict.Internal.html#zipWithMaybeAMatched"><span class="hs-identifier hs-type">zipWithMaybeAMatched</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier hs-type">Applicative</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185622"><span class="hs-identifier hs-type">f</span></a></span><span>
</span><span id="line-1125"></span><span>                     </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185621"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185620"><span class="hs-identifier hs-type">x</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185619"><span class="hs-identifier hs-type">y</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185622"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185618"><span class="hs-identifier hs-type">z</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1126"></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#WhenMatched"><span class="hs-identifier hs-type">WhenMatched</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185622"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185621"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185620"><span class="hs-identifier hs-type">x</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185619"><span class="hs-identifier hs-type">y</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185618"><span class="hs-identifier hs-type">z</span></a></span></span></span></span></span></span><span>
</span><span id="line-1127"></span><span id="zipWithMaybeAMatched"><span class="annot"><span class="annottext">zipWithMaybeAMatched :: forall (f :: * -&gt; *) k x y z.
Applicative f =&gt;
(k -&gt; x -&gt; y -&gt; f (Maybe z)) -&gt; WhenMatched f k x y z
</span><a href="Data.Map.Strict.Internal.html#zipWithMaybeAMatched"><span class="hs-identifier hs-var hs-var">zipWithMaybeAMatched</span></a></span></span><span> </span><span id="local-6989586621679184751"><span class="annot"><span class="annottext">k -&gt; x -&gt; y -&gt; f (Maybe z)
</span><a href="#local-6989586621679184751"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; x -&gt; y -&gt; f (Maybe z)) -&gt; WhenMatched f k x y z
forall (f :: * -&gt; *) k x y z.
(k -&gt; x -&gt; y -&gt; f (Maybe z)) -&gt; WhenMatched f k x y z
</span><a href="Data.Map.Internal.html#WhenMatched"><span class="hs-identifier hs-var">WhenMatched</span></a></span><span> </span><span class="annot"><span class="annottext">((k -&gt; x -&gt; y -&gt; f (Maybe z)) -&gt; WhenMatched f k x y z)
-&gt; (k -&gt; x -&gt; y -&gt; f (Maybe z)) -&gt; WhenMatched f k x y z
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1128"></span><span>  </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679184750"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184750"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679184749"><span class="annot"><span class="annottext">x
</span><a href="#local-6989586621679184749"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679184748"><span class="annot"><span class="annottext">y
</span><a href="#local-6989586621679184748"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe z -&gt; Maybe z
forall a. Maybe a -&gt; Maybe a
</span><a href="Data.Map.Strict.Internal.html#forceMaybe"><span class="hs-identifier hs-var">forceMaybe</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe z -&gt; Maybe z) -&gt; f (Maybe z) -&gt; f (Maybe z)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; x -&gt; y -&gt; f (Maybe z)
</span><a href="#local-6989586621679184751"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184750"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">x
</span><a href="#local-6989586621679184749"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">y
</span><a href="#local-6989586621679184748"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-1129"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#zipWithMaybeAMatched"><span class="hs-pragma hs-type">zipWithMaybeAMatched</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1130"></span><span>
</span><span id="line-1131"></span><span class="hs-comment">-- | When a key is found in both maps, apply a function to the</span><span>
</span><span id="line-1132"></span><span class="hs-comment">-- key and values to produce an action and use its result in the merged map.</span><span>
</span><span id="line-1133"></span><span id="local-6989586621679185605"><span id="local-6989586621679185606"><span id="local-6989586621679185607"><span id="local-6989586621679185608"><span id="local-6989586621679185609"><span class="annot"><a href="Data.Map.Strict.Internal.html#zipWithAMatched"><span class="hs-identifier hs-type">zipWithAMatched</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier hs-type">Applicative</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185609"><span class="hs-identifier hs-type">f</span></a></span><span>
</span><span id="line-1134"></span><span>                </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185608"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185607"><span class="hs-identifier hs-type">x</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185606"><span class="hs-identifier hs-type">y</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185609"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185605"><span class="hs-identifier hs-type">z</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1135"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#WhenMatched"><span class="hs-identifier hs-type">WhenMatched</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185609"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185608"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185607"><span class="hs-identifier hs-type">x</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185606"><span class="hs-identifier hs-type">y</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185605"><span class="hs-identifier hs-type">z</span></a></span></span></span></span></span></span><span>
</span><span id="line-1136"></span><span id="zipWithAMatched"><span class="annot"><span class="annottext">zipWithAMatched :: forall (f :: * -&gt; *) k x y z.
Applicative f =&gt;
(k -&gt; x -&gt; y -&gt; f z) -&gt; WhenMatched f k x y z
</span><a href="Data.Map.Strict.Internal.html#zipWithAMatched"><span class="hs-identifier hs-var hs-var">zipWithAMatched</span></a></span></span><span> </span><span id="local-6989586621679184743"><span class="annot"><span class="annottext">k -&gt; x -&gt; y -&gt; f z
</span><a href="#local-6989586621679184743"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; x -&gt; y -&gt; f (Maybe z)) -&gt; WhenMatched f k x y z
forall (f :: * -&gt; *) k x y z.
(k -&gt; x -&gt; y -&gt; f (Maybe z)) -&gt; WhenMatched f k x y z
</span><a href="Data.Map.Internal.html#WhenMatched"><span class="hs-identifier hs-var">WhenMatched</span></a></span><span> </span><span class="annot"><span class="annottext">((k -&gt; x -&gt; y -&gt; f (Maybe z)) -&gt; WhenMatched f k x y z)
-&gt; (k -&gt; x -&gt; y -&gt; f (Maybe z)) -&gt; WhenMatched f k x y z
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1137"></span><span>  </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679184742"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184742"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679184741"><span class="annot"><span class="annottext">x
</span><a href="#local-6989586621679184741"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679184740"><span class="annot"><span class="annottext">y
</span><a href="#local-6989586621679184740"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">z -&gt; Maybe z
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(z -&gt; Maybe z) -&gt; z -&gt; Maybe z
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(z -&gt; Maybe z) -&gt; f z -&gt; f (Maybe z)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; x -&gt; y -&gt; f z
</span><a href="#local-6989586621679184743"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184742"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">x
</span><a href="#local-6989586621679184741"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">y
</span><a href="#local-6989586621679184740"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-1138"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#zipWithAMatched"><span class="hs-pragma hs-type">zipWithAMatched</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1139"></span><span>
</span><span id="line-1140"></span><span class="hs-comment">-- | When a key is found in both maps, apply a function to the</span><span>
</span><span id="line-1141"></span><span class="hs-comment">-- key and values and use the result in the merged map.</span><span>
</span><span id="line-1142"></span><span class="hs-comment">--</span><span>
</span><span id="line-1143"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1144"></span><span class="hs-comment">-- zipWithMatched :: (k -&gt; x -&gt; y -&gt; z)</span><span>
</span><span id="line-1145"></span><span class="hs-comment">--                -&gt; SimpleWhenMatched k x y z</span><span>
</span><span id="line-1146"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1147"></span><span id="local-6989586621679185595"><span id="local-6989586621679185596"><span id="local-6989586621679185597"><span id="local-6989586621679185598"><span id="local-6989586621679185599"><span class="annot"><a href="Data.Map.Strict.Internal.html#zipWithMatched"><span class="hs-identifier hs-type">zipWithMatched</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier hs-type">Applicative</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185599"><span class="hs-identifier hs-type">f</span></a></span><span>
</span><span id="line-1148"></span><span>               </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185598"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185597"><span class="hs-identifier hs-type">x</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185596"><span class="hs-identifier hs-type">y</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185595"><span class="hs-identifier hs-type">z</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#WhenMatched"><span class="hs-identifier hs-type">WhenMatched</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185599"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185598"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185597"><span class="hs-identifier hs-type">x</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185596"><span class="hs-identifier hs-type">y</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185595"><span class="hs-identifier hs-type">z</span></a></span></span></span></span></span></span><span>
</span><span id="line-1149"></span><span id="zipWithMatched"><span class="annot"><span class="annottext">zipWithMatched :: forall (f :: * -&gt; *) k x y z.
Applicative f =&gt;
(k -&gt; x -&gt; y -&gt; z) -&gt; WhenMatched f k x y z
</span><a href="Data.Map.Strict.Internal.html#zipWithMatched"><span class="hs-identifier hs-var hs-var">zipWithMatched</span></a></span></span><span> </span><span id="local-6989586621679184737"><span class="annot"><span class="annottext">k -&gt; x -&gt; y -&gt; z
</span><a href="#local-6989586621679184737"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; x -&gt; y -&gt; f (Maybe z)) -&gt; WhenMatched f k x y z
forall (f :: * -&gt; *) k x y z.
(k -&gt; x -&gt; y -&gt; f (Maybe z)) -&gt; WhenMatched f k x y z
</span><a href="Data.Map.Internal.html#WhenMatched"><span class="hs-identifier hs-var">WhenMatched</span></a></span><span> </span><span class="annot"><span class="annottext">((k -&gt; x -&gt; y -&gt; f (Maybe z)) -&gt; WhenMatched f k x y z)
-&gt; (k -&gt; x -&gt; y -&gt; f (Maybe z)) -&gt; WhenMatched f k x y z
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1150"></span><span>  </span><span class="hs-glyph">\</span><span id="local-6989586621679184736"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184736"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679184735"><span class="annot"><span class="annottext">x
</span><a href="#local-6989586621679184735"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679184734"><span class="annot"><span class="annottext">y
</span><a href="#local-6989586621679184734"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe z -&gt; f (Maybe z)
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe z -&gt; f (Maybe z)) -&gt; Maybe z -&gt; f (Maybe z)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">z -&gt; Maybe z
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(z -&gt; Maybe z) -&gt; z -&gt; Maybe z
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; x -&gt; y -&gt; z
</span><a href="#local-6989586621679184737"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184736"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">x
</span><a href="#local-6989586621679184735"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">y
</span><a href="#local-6989586621679184734"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-1151"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#zipWithMatched"><span class="hs-pragma hs-type">zipWithMatched</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1152"></span><span>
</span><span id="line-1153"></span><span class="hs-comment">-- | Map over the entries whose keys are missing from the other map,</span><span>
</span><span id="line-1154"></span><span class="hs-comment">-- optionally removing some. This is the most powerful 'SimpleWhenMissing'</span><span>
</span><span id="line-1155"></span><span class="hs-comment">-- tactic, but others are usually more efficient.</span><span>
</span><span id="line-1156"></span><span class="hs-comment">--</span><span>
</span><span id="line-1157"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1158"></span><span class="hs-comment">-- mapMaybeMissing :: (k -&gt; x -&gt; Maybe y) -&gt; SimpleWhenMissing k x y</span><span>
</span><span id="line-1159"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1160"></span><span class="hs-comment">--</span><span>
</span><span id="line-1161"></span><span class="hs-comment">-- prop&gt; mapMaybeMissing f = traverseMaybeMissing (\k x -&gt; pure (f k x))</span><span>
</span><span id="line-1162"></span><span class="hs-comment">--</span><span>
</span><span id="line-1163"></span><span class="hs-comment">-- but @mapMaybeMissing@ uses fewer unnecessary 'Applicative' operations.</span><span>
</span><span id="line-1164"></span><span id="local-6989586621679185586"><span id="local-6989586621679185587"><span id="local-6989586621679185588"><span id="local-6989586621679185589"><span class="annot"><a href="Data.Map.Strict.Internal.html#mapMaybeMissing"><span class="hs-identifier hs-type">mapMaybeMissing</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier hs-type">Applicative</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185589"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185588"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185587"><span class="hs-identifier hs-type">x</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185586"><span class="hs-identifier hs-type">y</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#WhenMissing"><span class="hs-identifier hs-type">WhenMissing</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185589"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185588"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185587"><span class="hs-identifier hs-type">x</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185586"><span class="hs-identifier hs-type">y</span></a></span></span></span></span></span><span>
</span><span id="line-1165"></span><span id="mapMaybeMissing"><span class="annot"><span class="annottext">mapMaybeMissing :: forall (f :: * -&gt; *) k x y.
Applicative f =&gt;
(k -&gt; x -&gt; Maybe y) -&gt; WhenMissing f k x y
</span><a href="Data.Map.Strict.Internal.html#mapMaybeMissing"><span class="hs-identifier hs-var hs-var">mapMaybeMissing</span></a></span></span><span> </span><span id="local-6989586621679184730"><span class="annot"><span class="annottext">k -&gt; x -&gt; Maybe y
</span><a href="#local-6989586621679184730"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WhenMissing :: forall (f :: * -&gt; *) k x y.
(Map k x -&gt; f (Map k y))
-&gt; (k -&gt; x -&gt; f (Maybe y)) -&gt; WhenMissing f k x y
</span><a href="Data.Map.Internal.html#WhenMissing"><span class="hs-identifier hs-type">WhenMissing</span></a></span><span>
</span><span id="line-1166"></span><span>  </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">missingSubtree :: Map k x -&gt; f (Map k y)
</span><a href="Data.Map.Internal.html#missingSubtree"><span class="hs-identifier hs-var">missingSubtree</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679184729"><span class="annot"><span class="annottext">Map k x
</span><a href="#local-6989586621679184729"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Map k y -&gt; f (Map k y)
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">(Map k y -&gt; f (Map k y)) -&gt; Map k y -&gt; f (Map k y)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">(k -&gt; x -&gt; Maybe y) -&gt; Map k x -&gt; Map k y
forall k a b. (k -&gt; a -&gt; Maybe b) -&gt; Map k a -&gt; Map k b
</span><a href="Data.Map.Strict.Internal.html#mapMaybeWithKey"><span class="hs-identifier hs-var">mapMaybeWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; x -&gt; Maybe y
</span><a href="#local-6989586621679184730"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Map k x
</span><a href="#local-6989586621679184729"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-1167"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">missingKey :: k -&gt; x -&gt; f (Maybe y)
</span><a href="Data.Map.Internal.html#missingKey"><span class="hs-identifier hs-var">missingKey</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679184728"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184728"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679184727"><span class="annot"><span class="annottext">x
</span><a href="#local-6989586621679184727"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe y -&gt; f (Maybe y)
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe y -&gt; f (Maybe y)) -&gt; Maybe y -&gt; f (Maybe y)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe y -&gt; Maybe y
forall a. Maybe a -&gt; Maybe a
</span><a href="Data.Map.Strict.Internal.html#forceMaybe"><span class="hs-identifier hs-var">forceMaybe</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe y -&gt; Maybe y) -&gt; Maybe y -&gt; Maybe y
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; x -&gt; Maybe y
</span><a href="#local-6989586621679184730"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184728"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">x
</span><a href="#local-6989586621679184727"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1168"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapMaybeMissing"><span class="hs-pragma hs-type">mapMaybeMissing</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1169"></span><span>
</span><span id="line-1170"></span><span class="hs-comment">-- | Map over the entries whose keys are missing from the other map.</span><span>
</span><span id="line-1171"></span><span class="hs-comment">--</span><span>
</span><span id="line-1172"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1173"></span><span class="hs-comment">-- mapMissing :: (k -&gt; x -&gt; y) -&gt; SimpleWhenMissing k x y</span><span>
</span><span id="line-1174"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-1175"></span><span class="hs-comment">--</span><span>
</span><span id="line-1176"></span><span class="hs-comment">-- prop&gt; mapMissing f = mapMaybeMissing (\k x -&gt; Just $ f k x)</span><span>
</span><span id="line-1177"></span><span class="hs-comment">--</span><span>
</span><span id="line-1178"></span><span class="hs-comment">-- but @mapMissing@ is somewhat faster.</span><span>
</span><span id="line-1179"></span><span id="local-6989586621679185575"><span id="local-6989586621679185576"><span id="local-6989586621679185577"><span id="local-6989586621679185578"><span class="annot"><a href="Data.Map.Strict.Internal.html#mapMissing"><span class="hs-identifier hs-type">mapMissing</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier hs-type">Applicative</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185578"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185577"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185576"><span class="hs-identifier hs-type">x</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185575"><span class="hs-identifier hs-type">y</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#WhenMissing"><span class="hs-identifier hs-type">WhenMissing</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185578"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185577"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185576"><span class="hs-identifier hs-type">x</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185575"><span class="hs-identifier hs-type">y</span></a></span></span></span></span></span><span>
</span><span id="line-1180"></span><span id="mapMissing"><span class="annot"><span class="annottext">mapMissing :: forall (f :: * -&gt; *) k x y.
Applicative f =&gt;
(k -&gt; x -&gt; y) -&gt; WhenMissing f k x y
</span><a href="Data.Map.Strict.Internal.html#mapMissing"><span class="hs-identifier hs-var hs-var">mapMissing</span></a></span></span><span> </span><span id="local-6989586621679184723"><span class="annot"><span class="annottext">k -&gt; x -&gt; y
</span><a href="#local-6989586621679184723"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WhenMissing :: forall (f :: * -&gt; *) k x y.
(Map k x -&gt; f (Map k y))
-&gt; (k -&gt; x -&gt; f (Maybe y)) -&gt; WhenMissing f k x y
</span><a href="Data.Map.Internal.html#WhenMissing"><span class="hs-identifier hs-type">WhenMissing</span></a></span><span>
</span><span id="line-1181"></span><span>  </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">missingSubtree :: Map k x -&gt; f (Map k y)
</span><a href="Data.Map.Internal.html#missingSubtree"><span class="hs-identifier hs-var">missingSubtree</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679184722"><span class="annot"><span class="annottext">Map k x
</span><a href="#local-6989586621679184722"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Map k y -&gt; f (Map k y)
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">(Map k y -&gt; f (Map k y)) -&gt; Map k y -&gt; f (Map k y)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">(k -&gt; x -&gt; y) -&gt; Map k x -&gt; Map k y
forall k a b. (k -&gt; a -&gt; b) -&gt; Map k a -&gt; Map k b
</span><a href="Data.Map.Strict.Internal.html#mapWithKey"><span class="hs-identifier hs-var">mapWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; x -&gt; y
</span><a href="#local-6989586621679184723"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Map k x
</span><a href="#local-6989586621679184722"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-1182"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">missingKey :: k -&gt; x -&gt; f (Maybe y)
</span><a href="Data.Map.Internal.html#missingKey"><span class="hs-identifier hs-var">missingKey</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679184721"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184721"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679184720"><span class="annot"><span class="annottext">x
</span><a href="#local-6989586621679184720"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe y -&gt; f (Maybe y)
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe y -&gt; f (Maybe y)) -&gt; Maybe y -&gt; f (Maybe y)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">y -&gt; Maybe y
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(y -&gt; Maybe y) -&gt; y -&gt; Maybe y
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; x -&gt; y
</span><a href="#local-6989586621679184723"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184721"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">x
</span><a href="#local-6989586621679184720"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1183"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapMissing"><span class="hs-pragma hs-type">mapMissing</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1184"></span><span>
</span><span id="line-1185"></span><span class="hs-comment">-- | Traverse over the entries whose keys are missing from the other map,</span><span>
</span><span id="line-1186"></span><span class="hs-comment">-- optionally producing values to put in the result.</span><span>
</span><span id="line-1187"></span><span class="hs-comment">-- This is the most powerful 'WhenMissing' tactic, but others are usually</span><span>
</span><span id="line-1188"></span><span class="hs-comment">-- more efficient.</span><span>
</span><span id="line-1189"></span><span id="local-6989586621679185564"><span id="local-6989586621679185565"><span id="local-6989586621679185566"><span id="local-6989586621679185567"><span class="annot"><a href="Data.Map.Strict.Internal.html#traverseMaybeMissing"><span class="hs-identifier hs-type">traverseMaybeMissing</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier hs-type">Applicative</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185567"><span class="hs-identifier hs-type">f</span></a></span><span>
</span><span id="line-1190"></span><span>                     </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185566"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185565"><span class="hs-identifier hs-type">x</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185567"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185564"><span class="hs-identifier hs-type">y</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#WhenMissing"><span class="hs-identifier hs-type">WhenMissing</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185567"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185566"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185565"><span class="hs-identifier hs-type">x</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185564"><span class="hs-identifier hs-type">y</span></a></span></span></span></span></span><span>
</span><span id="line-1191"></span><span id="traverseMaybeMissing"><span class="annot"><span class="annottext">traverseMaybeMissing :: forall (f :: * -&gt; *) k x y.
Applicative f =&gt;
(k -&gt; x -&gt; f (Maybe y)) -&gt; WhenMissing f k x y
</span><a href="Data.Map.Strict.Internal.html#traverseMaybeMissing"><span class="hs-identifier hs-var hs-var">traverseMaybeMissing</span></a></span></span><span> </span><span id="local-6989586621679184715"><span class="annot"><span class="annottext">k -&gt; x -&gt; f (Maybe y)
</span><a href="#local-6989586621679184715"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WhenMissing :: forall (f :: * -&gt; *) k x y.
(Map k x -&gt; f (Map k y))
-&gt; (k -&gt; x -&gt; f (Maybe y)) -&gt; WhenMissing f k x y
</span><a href="Data.Map.Internal.html#WhenMissing"><span class="hs-identifier hs-type">WhenMissing</span></a></span><span>
</span><span id="line-1192"></span><span>  </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">missingSubtree :: Map k x -&gt; f (Map k y)
</span><a href="Data.Map.Internal.html#missingSubtree"><span class="hs-identifier hs-var">missingSubtree</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; x -&gt; f (Maybe y)) -&gt; Map k x -&gt; f (Map k y)
forall (f :: * -&gt; *) k a b.
Applicative f =&gt;
(k -&gt; a -&gt; f (Maybe b)) -&gt; Map k a -&gt; f (Map k b)
</span><a href="Data.Map.Strict.Internal.html#traverseMaybeWithKey"><span class="hs-identifier hs-var">traverseMaybeWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; x -&gt; f (Maybe y)
</span><a href="#local-6989586621679184715"><span class="hs-identifier hs-var">f</span></a></span><span>
</span><span id="line-1193"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">missingKey :: k -&gt; x -&gt; f (Maybe y)
</span><a href="Data.Map.Internal.html#missingKey"><span class="hs-identifier hs-var">missingKey</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679184714"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184714"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679184713"><span class="annot"><span class="annottext">x
</span><a href="#local-6989586621679184713"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe y -&gt; Maybe y
forall a. Maybe a -&gt; Maybe a
</span><a href="Data.Map.Strict.Internal.html#forceMaybe"><span class="hs-identifier hs-var">forceMaybe</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe y -&gt; Maybe y) -&gt; f (Maybe y) -&gt; f (Maybe y)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; x -&gt; f (Maybe y)
</span><a href="#local-6989586621679184715"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184714"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">x
</span><a href="#local-6989586621679184713"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1194"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#traverseMaybeMissing"><span class="hs-pragma hs-type">traverseMaybeMissing</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1195"></span><span>
</span><span id="line-1196"></span><span class="hs-comment">-- | Traverse over the entries whose keys are missing from the other map.</span><span>
</span><span id="line-1197"></span><span id="local-6989586621679185552"><span id="local-6989586621679185553"><span id="local-6989586621679185554"><span id="local-6989586621679185555"><span class="annot"><a href="Data.Map.Strict.Internal.html#traverseMissing"><span class="hs-identifier hs-type">traverseMissing</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier hs-type">Applicative</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185555"><span class="hs-identifier hs-type">f</span></a></span><span>
</span><span id="line-1198"></span><span>                     </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185554"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185553"><span class="hs-identifier hs-type">x</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185555"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185552"><span class="hs-identifier hs-type">y</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#WhenMissing"><span class="hs-identifier hs-type">WhenMissing</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185555"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185554"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185553"><span class="hs-identifier hs-type">x</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185552"><span class="hs-identifier hs-type">y</span></a></span></span></span></span></span><span>
</span><span id="line-1199"></span><span id="traverseMissing"><span class="annot"><span class="annottext">traverseMissing :: forall (f :: * -&gt; *) k x y.
Applicative f =&gt;
(k -&gt; x -&gt; f y) -&gt; WhenMissing f k x y
</span><a href="Data.Map.Strict.Internal.html#traverseMissing"><span class="hs-identifier hs-var hs-var">traverseMissing</span></a></span></span><span> </span><span id="local-6989586621679184708"><span class="annot"><span class="annottext">k -&gt; x -&gt; f y
</span><a href="#local-6989586621679184708"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WhenMissing :: forall (f :: * -&gt; *) k x y.
(Map k x -&gt; f (Map k y))
-&gt; (k -&gt; x -&gt; f (Maybe y)) -&gt; WhenMissing f k x y
</span><a href="Data.Map.Internal.html#WhenMissing"><span class="hs-identifier hs-type">WhenMissing</span></a></span><span>
</span><span id="line-1200"></span><span>  </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">missingSubtree :: Map k x -&gt; f (Map k y)
</span><a href="Data.Map.Internal.html#missingSubtree"><span class="hs-identifier hs-var">missingSubtree</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; x -&gt; f y) -&gt; Map k x -&gt; f (Map k y)
forall (t :: * -&gt; *) k a b.
Applicative t =&gt;
(k -&gt; a -&gt; t b) -&gt; Map k a -&gt; t (Map k b)
</span><a href="Data.Map.Strict.Internal.html#traverseWithKey"><span class="hs-identifier hs-var">traverseWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; x -&gt; f y
</span><a href="#local-6989586621679184708"><span class="hs-identifier hs-var">f</span></a></span><span>
</span><span id="line-1201"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">missingKey :: k -&gt; x -&gt; f (Maybe y)
</span><a href="Data.Map.Internal.html#missingKey"><span class="hs-identifier hs-var">missingKey</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679184707"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184707"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679184706"><span class="annot"><span class="annottext">x
</span><a href="#local-6989586621679184706"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">y -&gt; Maybe y
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(y -&gt; Maybe y) -&gt; y -&gt; Maybe y
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(y -&gt; Maybe y) -&gt; f y -&gt; f (Maybe y)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; x -&gt; f y
</span><a href="#local-6989586621679184708"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184707"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">x
</span><a href="#local-6989586621679184706"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1202"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#traverseMissing"><span class="hs-pragma hs-type">traverseMissing</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1203"></span><span>
</span><span id="line-1204"></span><span id="local-6989586621679185652"><span class="annot"><a href="Data.Map.Strict.Internal.html#forceMaybe"><span class="hs-identifier hs-type">forceMaybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185652"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185652"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1205"></span><span id="forceMaybe"><span class="annot"><span class="annottext">forceMaybe :: forall a. Maybe a -&gt; Maybe a
</span><a href="Data.Map.Strict.Internal.html#forceMaybe"><span class="hs-identifier hs-var hs-var">forceMaybe</span></a></span></span><span> </span><span class="annot"><span class="annottext">Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1206"></span><span class="annot"><a href="Data.Map.Strict.Internal.html#forceMaybe"><span class="hs-identifier hs-var">forceMaybe</span></a></span><span> </span><span id="local-6989586621679184705"><span class="annot"><span class="annottext">m :: Maybe a
</span><a href="#local-6989586621679184705"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679184705"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-1207"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#forceMaybe"><span class="hs-pragma hs-type">forceMaybe</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1208"></span><span>
</span><span id="line-1209"></span><span class="hs-comment">{--------------------------------------------------------------------
  MergeWithKey
--------------------------------------------------------------------}</span><span>
</span><span id="line-1212"></span><span>
</span><span id="line-1213"></span><span class="hs-comment">-- | /O(n+m)/. An unsafe universal combining function.</span><span>
</span><span id="line-1214"></span><span class="hs-comment">--</span><span>
</span><span id="line-1215"></span><span class="hs-comment">-- WARNING: This function can produce corrupt maps and its results</span><span>
</span><span id="line-1216"></span><span class="hs-comment">-- may depend on the internal structures of its inputs. Users should</span><span>
</span><span id="line-1217"></span><span class="hs-comment">-- prefer 'Data.Map.Merge.Strict.merge' or</span><span>
</span><span id="line-1218"></span><span class="hs-comment">-- 'Data.Map.Merge.Strict.mergeA'.</span><span>
</span><span id="line-1219"></span><span class="hs-comment">--</span><span>
</span><span id="line-1220"></span><span class="hs-comment">-- When 'mergeWithKey' is given three arguments, it is inlined to the call</span><span>
</span><span id="line-1221"></span><span class="hs-comment">-- site. You should therefore use 'mergeWithKey' only to define custom</span><span>
</span><span id="line-1222"></span><span class="hs-comment">-- combining functions. For example, you could define 'unionWithKey',</span><span>
</span><span id="line-1223"></span><span class="hs-comment">-- 'differenceWithKey' and 'intersectionWithKey' as</span><span>
</span><span id="line-1224"></span><span class="hs-comment">--</span><span>
</span><span id="line-1225"></span><span class="hs-comment">-- &gt; myUnionWithKey f m1 m2 = mergeWithKey (\k x1 x2 -&gt; Just (f k x1 x2)) id id m1 m2</span><span>
</span><span id="line-1226"></span><span class="hs-comment">-- &gt; myDifferenceWithKey f m1 m2 = mergeWithKey f id (const empty) m1 m2</span><span>
</span><span id="line-1227"></span><span class="hs-comment">-- &gt; myIntersectionWithKey f m1 m2 = mergeWithKey (\k x1 x2 -&gt; Just (f k x1 x2)) (const empty) (const empty) m1 m2</span><span>
</span><span id="line-1228"></span><span class="hs-comment">--</span><span>
</span><span id="line-1229"></span><span class="hs-comment">-- When calling @'mergeWithKey' combine only1 only2@, a function combining two</span><span>
</span><span id="line-1230"></span><span class="hs-comment">-- 'Map's is created, such that</span><span>
</span><span id="line-1231"></span><span class="hs-comment">--</span><span>
</span><span id="line-1232"></span><span class="hs-comment">-- * if a key is present in both maps, it is passed with both corresponding</span><span>
</span><span id="line-1233"></span><span class="hs-comment">--   values to the @combine@ function. Depending on the result, the key is either</span><span>
</span><span id="line-1234"></span><span class="hs-comment">--   present in the result with specified value, or is left out;</span><span>
</span><span id="line-1235"></span><span class="hs-comment">--</span><span>
</span><span id="line-1236"></span><span class="hs-comment">-- * a nonempty subtree present only in the first map is passed to @only1@ and</span><span>
</span><span id="line-1237"></span><span class="hs-comment">--   the output is added to the result;</span><span>
</span><span id="line-1238"></span><span class="hs-comment">--</span><span>
</span><span id="line-1239"></span><span class="hs-comment">-- * a nonempty subtree present only in the second map is passed to @only2@ and</span><span>
</span><span id="line-1240"></span><span class="hs-comment">--   the output is added to the result.</span><span>
</span><span id="line-1241"></span><span class="hs-comment">--</span><span>
</span><span id="line-1242"></span><span class="hs-comment">-- The @only1@ and @only2@ methods /must return a map with a subset (possibly empty) of the keys of the given map/.</span><span>
</span><span id="line-1243"></span><span class="hs-comment">-- The values can be modified arbitrarily. Most common variants of @only1@ and</span><span>
</span><span id="line-1244"></span><span class="hs-comment">-- @only2@ are 'id' and @'const' 'empty'@, but for example @'map' f@ or</span><span>
</span><span id="line-1245"></span><span class="hs-comment">-- @'filterWithKey' f@ could be used for any @f@.</span><span>
</span><span id="line-1246"></span><span>
</span><span id="line-1247"></span><span id="local-6989586621679185539"><span id="local-6989586621679185540"><span id="local-6989586621679185541"><span id="local-6989586621679185542"><span class="annot"><a href="Data.Map.Strict.Internal.html#mergeWithKey"><span class="hs-identifier hs-type">mergeWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185542"><span class="hs-identifier hs-type">k</span></a></span><span>
</span><span id="line-1248"></span><span>             </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185542"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185541"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185540"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185539"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1249"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185542"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185541"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185542"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185539"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1250"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185542"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185540"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185542"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185539"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1251"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185542"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185541"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185542"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185540"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185542"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185539"><span class="hs-identifier hs-type">c</span></a></span></span></span></span></span><span>
</span><span id="line-1252"></span><span id="mergeWithKey"><span class="annot"><span class="annottext">mergeWithKey :: forall k a b c.
Ord k =&gt;
(k -&gt; a -&gt; b -&gt; Maybe c)
-&gt; (Map k a -&gt; Map k c)
-&gt; (Map k b -&gt; Map k c)
-&gt; Map k a
-&gt; Map k b
-&gt; Map k c
</span><a href="Data.Map.Strict.Internal.html#mergeWithKey"><span class="hs-identifier hs-var hs-var">mergeWithKey</span></a></span></span><span> </span><span id="local-6989586621679184703"><span class="annot"><span class="annottext">k -&gt; a -&gt; b -&gt; Maybe c
</span><a href="#local-6989586621679184703"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184702"><span class="annot"><span class="annottext">Map k a -&gt; Map k c
</span><a href="#local-6989586621679184702"><span class="hs-identifier hs-var">g1</span></a></span></span><span> </span><span id="local-6989586621679184701"><span class="annot"><span class="annottext">Map k b -&gt; Map k c
</span><a href="#local-6989586621679184701"><span class="hs-identifier hs-var">g2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; Map k b -&gt; Map k c
</span><a href="#local-6989586621679184700"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-1253"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1254"></span><span>    </span><span id="local-6989586621679184700"><span class="annot"><span class="annottext">go :: Map k a -&gt; Map k b -&gt; Map k c
</span><a href="#local-6989586621679184700"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span id="local-6989586621679184697"><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184697"><span class="hs-identifier hs-var">t2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k b -&gt; Map k c
</span><a href="#local-6989586621679184701"><span class="hs-identifier hs-var">g2</span></a></span><span> </span><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184697"><span class="hs-identifier hs-var">t2</span></a></span><span>
</span><span id="line-1255"></span><span>    </span><span class="annot"><a href="#local-6989586621679184700"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679184696"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184696"><span class="hs-identifier hs-var">t1</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k b
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; Map k c
</span><a href="#local-6989586621679184702"><span class="hs-identifier hs-var">g1</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184696"><span class="hs-identifier hs-var">t1</span></a></span><span>
</span><span id="line-1256"></span><span>    </span><span class="annot"><a href="#local-6989586621679184700"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184695"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184695"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679184694"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184694"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679184693"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184693"><span class="hs-identifier hs-var">l1</span></a></span></span><span> </span><span id="local-6989586621679184692"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184692"><span class="hs-identifier hs-var">r1</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679184691"><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184691"><span class="hs-identifier hs-var">t2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1257"></span><span>      </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe b
</span><a href="#local-6989586621679184690"><span class="hs-identifier hs-var">found</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1258"></span><span>        </span><span class="annot"><span class="annottext">Maybe b
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; Map k c
</span><a href="#local-6989586621679184702"><span class="hs-identifier hs-var">g1</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#singleton"><span class="hs-identifier hs-var">singleton</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184695"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184694"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1259"></span><span>                     </span><span class="annot"><span class="annottext">Map k c
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Map k c -&gt; Map k c -&gt; Map k c
forall k a. Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#link2"><span class="hs-identifier hs-var">link2</span></a></span><span> </span><span class="annot"><span class="annottext">Map k c
</span><a href="#local-6989586621679184689"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k c
</span><a href="#local-6989586621679184688"><span class="hs-identifier hs-var">r'</span></a></span><span>
</span><span id="line-1260"></span><span>                     </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">k
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184687"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679184687"><span class="hs-identifier hs-var">x'</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k c
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Map k c
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">k -&gt; c -&gt; Map k c -&gt; Map k c -&gt; Map k c
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184695"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679184687"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k c
</span><a href="#local-6989586621679184689"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k c
</span><a href="#local-6989586621679184688"><span class="hs-identifier hs-var">r'</span></a></span><span>
</span><span id="line-1261"></span><span>                     </span><span class="annot"><span class="annottext">Map k c
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; Map k c
forall a. HasCallStack =&gt; [Char] -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">[Char]
</span><span class="hs-string">&quot;mergeWithKey: Given function only1 does not fulfill required conditions (see documentation)&quot;</span></span><span>
</span><span id="line-1262"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679184686"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679184686"><span class="hs-identifier hs-var">x2</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; b -&gt; Maybe c
</span><a href="#local-6989586621679184703"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184695"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184694"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679184686"><span class="hs-identifier hs-var">x2</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1263"></span><span>                     </span><span class="annot"><span class="annottext">Maybe c
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Map k c -&gt; Map k c -&gt; Map k c
forall k a. Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#link2"><span class="hs-identifier hs-var">link2</span></a></span><span> </span><span class="annot"><span class="annottext">Map k c
</span><a href="#local-6989586621679184689"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k c
</span><a href="#local-6989586621679184688"><span class="hs-identifier hs-var">r'</span></a></span><span>
</span><span id="line-1264"></span><span>                     </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679184685"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679184685"><span class="hs-identifier hs-var">x'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">k -&gt; c -&gt; Map k c -&gt; Map k c -&gt; Map k c
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184695"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679184685"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k c
</span><a href="#local-6989586621679184689"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k c
</span><a href="#local-6989586621679184688"><span class="hs-identifier hs-var">r'</span></a></span><span>
</span><span id="line-1265"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-1266"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621679184683"><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184683"><span class="hs-identifier hs-var">l2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184690"><span class="annot"><span class="annottext">Maybe b
</span><a href="#local-6989586621679184690"><span class="hs-identifier hs-var">found</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184682"><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184682"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; Map k b -&gt; (Map k b, Maybe b, Map k b)
forall k a. Ord k =&gt; k -&gt; Map k a -&gt; (Map k a, Maybe a, Map k a)
</span><a href="Data.Map.Internal.html#splitLookup"><span class="hs-identifier hs-var">splitLookup</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184695"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184691"><span class="hs-identifier hs-var">t2</span></a></span><span>
</span><span id="line-1267"></span><span>        </span><span id="local-6989586621679184689"><span class="annot"><span class="annottext">l' :: Map k c
</span><a href="#local-6989586621679184689"><span class="hs-identifier hs-var hs-var">l'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; Map k b -&gt; Map k c
</span><a href="#local-6989586621679184700"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184693"><span class="hs-identifier hs-var">l1</span></a></span><span> </span><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184683"><span class="hs-identifier hs-var">l2</span></a></span><span>
</span><span id="line-1268"></span><span>        </span><span id="local-6989586621679184688"><span class="annot"><span class="annottext">r' :: Map k c
</span><a href="#local-6989586621679184688"><span class="hs-identifier hs-var hs-var">r'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; Map k b -&gt; Map k c
</span><a href="#local-6989586621679184700"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184692"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184682"><span class="hs-identifier hs-var">r2</span></a></span><span>
</span><span id="line-1269"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mergeWithKey"><span class="hs-pragma hs-type">mergeWithKey</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1270"></span><span>
</span><span id="line-1271"></span><span class="hs-comment">{--------------------------------------------------------------------
  Filter and partition
--------------------------------------------------------------------}</span><span>
</span><span id="line-1274"></span><span>
</span><span id="line-1275"></span><span class="hs-comment">-- | /O(n)/. Map values and collect the 'Just' results.</span><span>
</span><span id="line-1276"></span><span class="hs-comment">--</span><span>
</span><span id="line-1277"></span><span class="hs-comment">-- &gt; let f x = if x == &quot;a&quot; then Just &quot;new a&quot; else Nothing</span><span>
</span><span id="line-1278"></span><span class="hs-comment">-- &gt; mapMaybe f (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == singleton 5 &quot;new a&quot;</span><span>
</span><span id="line-1279"></span><span>
</span><span id="line-1280"></span><span id="local-6989586621679185532"><span id="local-6989586621679185533"><span id="local-6989586621679185534"><span class="annot"><a href="Data.Map.Strict.Internal.html#mapMaybe"><span class="hs-identifier hs-type">mapMaybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185534"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185533"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185532"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185534"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185532"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185533"><span class="hs-identifier hs-type">b</span></a></span></span></span></span><span>
</span><span id="line-1281"></span><span id="mapMaybe"><span class="annot"><span class="annottext">mapMaybe :: forall a b k. (a -&gt; Maybe b) -&gt; Map k a -&gt; Map k b
</span><a href="Data.Map.Strict.Internal.html#mapMaybe"><span class="hs-identifier hs-var hs-var">mapMaybe</span></a></span></span><span> </span><span id="local-6989586621679184681"><span class="annot"><span class="annottext">a -&gt; Maybe b
</span><a href="#local-6989586621679184681"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; a -&gt; Maybe b) -&gt; Map k a -&gt; Map k b
forall k a b. (k -&gt; a -&gt; Maybe b) -&gt; Map k a -&gt; Map k b
</span><a href="Data.Map.Strict.Internal.html#mapMaybeWithKey"><span class="hs-identifier hs-var">mapMaybeWithKey</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">k
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184680"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184680"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe b
</span><a href="#local-6989586621679184681"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184680"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1282"></span><span>
</span><span id="line-1283"></span><span class="hs-comment">-- | /O(n)/. Map keys\/values and collect the 'Just' results.</span><span>
</span><span id="line-1284"></span><span class="hs-comment">--</span><span>
</span><span id="line-1285"></span><span class="hs-comment">-- &gt; let f k _ = if k &lt; 5 then Just (&quot;key : &quot; ++ (show k)) else Nothing</span><span>
</span><span id="line-1286"></span><span class="hs-comment">-- &gt; mapMaybeWithKey f (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == singleton 3 &quot;key : 3&quot;</span><span>
</span><span id="line-1287"></span><span>
</span><span id="line-1288"></span><span id="local-6989586621679185579"><span id="local-6989586621679185580"><span id="local-6989586621679185581"><span class="annot"><a href="Data.Map.Strict.Internal.html#mapMaybeWithKey"><span class="hs-identifier hs-type">mapMaybeWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185581"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185580"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185579"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185581"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185580"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185581"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185579"><span class="hs-identifier hs-type">b</span></a></span></span></span></span><span>
</span><span id="line-1289"></span><span id="mapMaybeWithKey"><span class="annot"><span class="annottext">mapMaybeWithKey :: forall k a b. (k -&gt; a -&gt; Maybe b) -&gt; Map k a -&gt; Map k b
</span><a href="Data.Map.Strict.Internal.html#mapMaybeWithKey"><span class="hs-identifier hs-var hs-var">mapMaybeWithKey</span></a></span></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe b
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k b
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1290"></span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapMaybeWithKey"><span class="hs-identifier hs-var">mapMaybeWithKey</span></a></span><span> </span><span id="local-6989586621679184679"><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe b
</span><a href="#local-6989586621679184679"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184678"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184678"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679184677"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184677"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679184676"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184676"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679184675"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184675"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe b
</span><a href="#local-6989586621679184679"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184678"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184677"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1291"></span><span>  </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679184674"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679184674"><span class="hs-identifier hs-var">y</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679184674"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; Map k b -&gt; Map k b
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">k -&gt; b -&gt; Map k b -&gt; Map k b -&gt; Map k b
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184678"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679184674"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(k -&gt; a -&gt; Maybe b) -&gt; Map k a -&gt; Map k b
forall k a b. (k -&gt; a -&gt; Maybe b) -&gt; Map k a -&gt; Map k b
</span><a href="Data.Map.Strict.Internal.html#mapMaybeWithKey"><span class="hs-identifier hs-var">mapMaybeWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe b
</span><a href="#local-6989586621679184679"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184676"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(k -&gt; a -&gt; Maybe b) -&gt; Map k a -&gt; Map k b
forall k a b. (k -&gt; a -&gt; Maybe b) -&gt; Map k a -&gt; Map k b
</span><a href="Data.Map.Strict.Internal.html#mapMaybeWithKey"><span class="hs-identifier hs-var">mapMaybeWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe b
</span><a href="#local-6989586621679184679"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184675"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1292"></span><span>  </span><span class="annot"><span class="annottext">Maybe b
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Map k b -&gt; Map k b -&gt; Map k b
forall k a. Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#link2"><span class="hs-identifier hs-var">link2</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(k -&gt; a -&gt; Maybe b) -&gt; Map k a -&gt; Map k b
forall k a b. (k -&gt; a -&gt; Maybe b) -&gt; Map k a -&gt; Map k b
</span><a href="Data.Map.Strict.Internal.html#mapMaybeWithKey"><span class="hs-identifier hs-var">mapMaybeWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe b
</span><a href="#local-6989586621679184679"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184676"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(k -&gt; a -&gt; Maybe b) -&gt; Map k a -&gt; Map k b
forall k a b. (k -&gt; a -&gt; Maybe b) -&gt; Map k a -&gt; Map k b
</span><a href="Data.Map.Strict.Internal.html#mapMaybeWithKey"><span class="hs-identifier hs-var">mapMaybeWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Maybe b
</span><a href="#local-6989586621679184679"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184675"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1293"></span><span>
</span><span id="line-1294"></span><span class="hs-comment">-- | /O(n)/. Traverse keys\/values and collect the 'Just' results.</span><span>
</span><span id="line-1295"></span><span class="hs-comment">--</span><span>
</span><span id="line-1296"></span><span class="hs-comment">-- @since 0.5.8</span><span>
</span><span id="line-1297"></span><span>
</span><span id="line-1298"></span><span id="local-6989586621679185556"><span id="local-6989586621679185557"><span id="local-6989586621679185558"><span id="local-6989586621679185559"><span class="annot"><a href="Data.Map.Strict.Internal.html#traverseMaybeWithKey"><span class="hs-identifier hs-type">traverseMaybeWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier hs-type">Applicative</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185559"><span class="hs-identifier hs-type">f</span></a></span><span>
</span><span id="line-1299"></span><span>                     </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185558"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185557"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185559"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185556"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185558"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185557"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185559"><span class="hs-identifier hs-type">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185558"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185556"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span></span></span></span></span><span>
</span><span id="line-1300"></span><span id="traverseMaybeWithKey"><span class="annot"><span class="annottext">traverseMaybeWithKey :: forall (f :: * -&gt; *) k a b.
Applicative f =&gt;
(k -&gt; a -&gt; f (Maybe b)) -&gt; Map k a -&gt; f (Map k b)
</span><a href="Data.Map.Strict.Internal.html#traverseMaybeWithKey"><span class="hs-identifier hs-var hs-var">traverseMaybeWithKey</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; a -&gt; f (Maybe b)) -&gt; Map k a -&gt; f (Map k b)
forall (f :: * -&gt; *) k a b.
Applicative f =&gt;
(k -&gt; a -&gt; f (Maybe b)) -&gt; Map k a -&gt; f (Map k b)
</span><a href="#local-6989586621679184671"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-1301"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1302"></span><span>    </span><span id="local-6989586621679184671"><span class="annot"><span class="annottext">go :: (k -&gt; t -&gt; f (Maybe a)) -&gt; Map k t -&gt; f (Map k a)
</span><a href="#local-6989586621679184671"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">k -&gt; t -&gt; f (Maybe a)
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Map k t
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; f (Map k a)
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1303"></span><span>    </span><span class="annot"><a href="#local-6989586621679184671"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679184665"><span class="annot"><span class="annottext">k -&gt; t -&gt; f (Maybe a)
</span><a href="#local-6989586621679184665"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184664"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184664"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679184663"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679184663"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k t
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Map k t
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; (a -&gt; Map k a) -&gt; Maybe a -&gt; Map k a
forall b a. b -&gt; (a -&gt; b) -&gt; Maybe a -&gt; b
</span><a href="../../base/src/Data.Maybe.html#maybe"><span class="hs-identifier hs-var">maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679184662"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184662"><span class="hs-identifier hs-var">x'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184664"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184662"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(Maybe a -&gt; Map k a) -&gt; f (Maybe a) -&gt; f (Map k a)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; t -&gt; f (Maybe a)
</span><a href="#local-6989586621679184665"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184664"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679184663"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-1304"></span><span>    </span><span class="annot"><a href="#local-6989586621679184671"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679184661"><span class="annot"><span class="annottext">k -&gt; t -&gt; f (Maybe a)
</span><a href="#local-6989586621679184661"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184660"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184660"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679184659"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679184659"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679184658"><span class="annot"><span class="annottext">Map k t
</span><a href="#local-6989586621679184658"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679184657"><span class="annot"><span class="annottext">Map k t
</span><a href="#local-6989586621679184657"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Map k a -&gt; Maybe a -&gt; Map k a -&gt; Map k a)
-&gt; f (Map k a) -&gt; f (Maybe a) -&gt; f (Map k a) -&gt; f (Map k a)
forall (f :: * -&gt; *) a b c d.
Applicative f =&gt;
(a -&gt; b -&gt; c -&gt; d) -&gt; f a -&gt; f b -&gt; f c -&gt; f d
</span><a href="../../base/src/GHC.Base.html#liftA3"><span class="hs-identifier hs-var">liftA3</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; Maybe a -&gt; Map k a -&gt; Map k a
forall {a}. Map k a -&gt; Maybe a -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679184656"><span class="hs-identifier hs-var">combine</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(k -&gt; t -&gt; f (Maybe a)) -&gt; Map k t -&gt; f (Map k a)
</span><a href="#local-6989586621679184671"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; t -&gt; f (Maybe a)
</span><a href="#local-6989586621679184661"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Map k t
</span><a href="#local-6989586621679184658"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k -&gt; t -&gt; f (Maybe a)
</span><a href="#local-6989586621679184661"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184660"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679184659"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(k -&gt; t -&gt; f (Maybe a)) -&gt; Map k t -&gt; f (Map k a)
</span><a href="#local-6989586621679184671"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; t -&gt; f (Maybe a)
</span><a href="#local-6989586621679184661"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Map k t
</span><a href="#local-6989586621679184657"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1305"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-1306"></span><span>        </span><span id="local-6989586621679184656"><span class="annot"><span class="annottext">combine :: Map k a -&gt; Maybe a -&gt; Map k a -&gt; Map k a
</span><a href="#local-6989586621679184656"><span class="hs-identifier hs-var hs-var">combine</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679184655"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184655"><span class="hs-identifier hs-var">l'</span></a></span></span><span> </span><span id="local-6989586621679184654"><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679184654"><span class="hs-identifier hs-var">mx</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679184653"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184653"><span class="hs-identifier hs-var">r'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621679184654"><span class="hs-identifier hs-var">mx</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1307"></span><span>          </span><span class="annot"><span class="annottext">Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; Map k a -&gt; Map k a
forall k a. Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#link2"><span class="hs-identifier hs-var">link2</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184655"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184653"><span class="hs-identifier hs-var">r'</span></a></span><span>
</span><span id="line-1308"></span><span>          </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679184652"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184652"><span class="hs-identifier hs-var">x'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184660"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184652"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184655"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184653"><span class="hs-identifier hs-var">r'</span></a></span><span>
</span><span id="line-1309"></span><span>
</span><span id="line-1310"></span><span class="hs-comment">-- | /O(n)/. Map values and separate the 'Left' and 'Right' results.</span><span>
</span><span id="line-1311"></span><span class="hs-comment">--</span><span>
</span><span id="line-1312"></span><span class="hs-comment">-- &gt; let f a = if a &lt; &quot;c&quot; then Left a else Right a</span><span>
</span><span id="line-1313"></span><span class="hs-comment">-- &gt; mapEither f (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;), (1,&quot;x&quot;), (7,&quot;z&quot;)])</span><span>
</span><span id="line-1314"></span><span class="hs-comment">-- &gt;     == (fromList [(3,&quot;b&quot;), (5,&quot;a&quot;)], fromList [(1,&quot;x&quot;), (7,&quot;z&quot;)])</span><span>
</span><span id="line-1315"></span><span class="hs-comment">-- &gt;</span><span>
</span><span id="line-1316"></span><span class="hs-comment">-- &gt; mapEither (\ a -&gt; Right a) (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;), (1,&quot;x&quot;), (7,&quot;z&quot;)])</span><span>
</span><span id="line-1317"></span><span class="hs-comment">-- &gt;     == (empty, fromList [(5,&quot;a&quot;), (3,&quot;b&quot;), (1,&quot;x&quot;), (7,&quot;z&quot;)])</span><span>
</span><span id="line-1318"></span><span>
</span><span id="line-1319"></span><span id="local-6989586621679185508"><span id="local-6989586621679185509"><span id="local-6989586621679185510"><span id="local-6989586621679185511"><span class="annot"><a href="Data.Map.Strict.Internal.html#mapEither"><span class="hs-identifier hs-type">mapEither</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185511"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185510"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185509"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185508"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185511"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185508"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185510"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185508"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185509"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span></span></span></span></span><span>
</span><span id="line-1320"></span><span id="mapEither"><span class="annot"><span class="annottext">mapEither :: forall a b c k. (a -&gt; Either b c) -&gt; Map k a -&gt; (Map k b, Map k c)
</span><a href="Data.Map.Strict.Internal.html#mapEither"><span class="hs-identifier hs-var hs-var">mapEither</span></a></span></span><span> </span><span id="local-6989586621679184651"><span class="annot"><span class="annottext">a -&gt; Either b c
</span><a href="#local-6989586621679184651"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184650"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184650"><span class="hs-identifier hs-var">m</span></a></span></span><span>
</span><span id="line-1321"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; a -&gt; Either b c) -&gt; Map k a -&gt; (Map k b, Map k c)
forall k a b c.
(k -&gt; a -&gt; Either b c) -&gt; Map k a -&gt; (Map k b, Map k c)
</span><a href="Data.Map.Strict.Internal.html#mapEitherWithKey"><span class="hs-identifier hs-var">mapEitherWithKey</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">k
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184649"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184649"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Either b c
</span><a href="#local-6989586621679184651"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184649"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184650"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-1322"></span><span>
</span><span id="line-1323"></span><span class="hs-comment">-- | /O(n)/. Map keys\/values and separate the 'Left' and 'Right' results.</span><span>
</span><span id="line-1324"></span><span class="hs-comment">--</span><span>
</span><span id="line-1325"></span><span class="hs-comment">-- &gt; let f k a = if k &lt; 5 then Left (k * 2) else Right (a ++ a)</span><span>
</span><span id="line-1326"></span><span class="hs-comment">-- &gt; mapEitherWithKey f (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;), (1,&quot;x&quot;), (7,&quot;z&quot;)])</span><span>
</span><span id="line-1327"></span><span class="hs-comment">-- &gt;     == (fromList [(1,2), (3,6)], fromList [(5,&quot;aa&quot;), (7,&quot;zz&quot;)])</span><span>
</span><span id="line-1328"></span><span class="hs-comment">-- &gt;</span><span>
</span><span id="line-1329"></span><span class="hs-comment">-- &gt; mapEitherWithKey (\_ a -&gt; Right a) (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;), (1,&quot;x&quot;), (7,&quot;z&quot;)])</span><span>
</span><span id="line-1330"></span><span class="hs-comment">-- &gt;     == (empty, fromList [(1,&quot;x&quot;), (3,&quot;b&quot;), (5,&quot;a&quot;), (7,&quot;z&quot;)])</span><span>
</span><span id="line-1331"></span><span>
</span><span id="line-1332"></span><span id="local-6989586621679185500"><span id="local-6989586621679185501"><span id="local-6989586621679185502"><span id="local-6989586621679185503"><span class="annot"><a href="Data.Map.Strict.Internal.html#mapEitherWithKey"><span class="hs-identifier hs-type">mapEitherWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185503"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185502"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185501"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185500"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185503"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185502"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185503"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185501"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185503"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185500"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span></span></span></span></span><span>
</span><span id="line-1333"></span><span id="mapEitherWithKey"><span class="annot"><span class="annottext">mapEitherWithKey :: forall k a b c.
(k -&gt; a -&gt; Either b c) -&gt; Map k a -&gt; (Map k b, Map k c)
</span><a href="Data.Map.Strict.Internal.html#mapEitherWithKey"><span class="hs-identifier hs-var hs-var">mapEitherWithKey</span></a></span></span><span> </span><span id="local-6989586621679184648"><span class="annot"><span class="annottext">k -&gt; a -&gt; Either b c
</span><a href="#local-6989586621679184648"><span class="hs-identifier hs-var">f0</span></a></span></span><span> </span><span id="local-6989586621679184647"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184647"><span class="hs-identifier hs-var">t0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrictPair (Map k b) (Map k c) -&gt; (Map k b, Map k c)
forall a b. StrictPair a b -&gt; (a, b)
</span><a href="Utils.Containers.Internal.StrictPair.html#toPair"><span class="hs-identifier hs-var">toPair</span></a></span><span> </span><span class="annot"><span class="annottext">(StrictPair (Map k b) (Map k c) -&gt; (Map k b, Map k c))
-&gt; StrictPair (Map k b) (Map k c) -&gt; (Map k b, Map k c)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(k -&gt; a -&gt; Either b c) -&gt; Map k a -&gt; StrictPair (Map k b) (Map k c)
forall {k} {t} {a} {a}.
(k -&gt; t -&gt; Either a a) -&gt; Map k t -&gt; StrictPair (Map k a) (Map k a)
</span><a href="#local-6989586621679184646"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Either b c
</span><a href="#local-6989586621679184648"><span class="hs-identifier hs-var">f0</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184647"><span class="hs-identifier hs-var">t0</span></a></span><span>
</span><span id="line-1334"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1335"></span><span>    </span><span id="local-6989586621679184646"><span class="annot"><span class="annottext">go :: (k -&gt; t -&gt; Either a a) -&gt; Map k t -&gt; StrictPair (Map k a) (Map k a)
</span><a href="#local-6989586621679184646"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">k -&gt; t -&gt; Either a a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Map k t
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; Map k a -&gt; StrictPair (Map k a) (Map k a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1336"></span><span>    </span><span class="annot"><a href="#local-6989586621679184646"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679184645"><span class="annot"><span class="annottext">k -&gt; t -&gt; Either a a
</span><a href="#local-6989586621679184645"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184644"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184644"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679184643"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679184643"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679184642"><span class="annot"><span class="annottext">Map k t
</span><a href="#local-6989586621679184642"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679184641"><span class="annot"><span class="annottext">Map k t
</span><a href="#local-6989586621679184641"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">k -&gt; t -&gt; Either a a
</span><a href="#local-6989586621679184645"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184644"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679184643"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1337"></span><span>      </span><span class="annot"><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-type">Left</span></a></span><span> </span><span id="local-6989586621679184640"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184640"><span class="hs-identifier hs-var">y</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184640"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">a
-&gt; StrictPair (Map k a) (Map k a) -&gt; StrictPair (Map k a) (Map k a)
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184644"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184640"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184639"><span class="hs-identifier hs-var">l1</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184638"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; Map k a -&gt; StrictPair (Map k a) (Map k a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; Map k a -&gt; Map k a
forall k a. Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#link2"><span class="hs-identifier hs-var">link2</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184637"><span class="hs-identifier hs-var">l2</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184636"><span class="hs-identifier hs-var">r2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1338"></span><span>      </span><span class="annot"><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-type">Right</span></a></span><span> </span><span id="local-6989586621679184635"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184635"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184635"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">a
-&gt; StrictPair (Map k a) (Map k a) -&gt; StrictPair (Map k a) (Map k a)
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Map k a -&gt; Map k a -&gt; Map k a
forall k a. Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#link2"><span class="hs-identifier hs-var">link2</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184639"><span class="hs-identifier hs-var">l1</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184638"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; Map k a -&gt; StrictPair (Map k a) (Map k a)
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184644"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184635"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184637"><span class="hs-identifier hs-var">l2</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184636"><span class="hs-identifier hs-var">r2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1339"></span><span>     </span><span class="hs-keyword">where</span><span>
</span><span id="line-1340"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621679184639"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184639"><span class="hs-identifier hs-var">l1</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679184637"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184637"><span class="hs-identifier hs-var">l2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; t -&gt; Either a a) -&gt; Map k t -&gt; StrictPair (Map k a) (Map k a)
</span><a href="#local-6989586621679184646"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; t -&gt; Either a a
</span><a href="#local-6989586621679184645"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Map k t
</span><a href="#local-6989586621679184642"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1341"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621679184638"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184638"><span class="hs-identifier hs-var">r1</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679184636"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184636"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; t -&gt; Either a a) -&gt; Map k t -&gt; StrictPair (Map k a) (Map k a)
</span><a href="#local-6989586621679184646"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; t -&gt; Either a a
</span><a href="#local-6989586621679184645"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Map k t
</span><a href="#local-6989586621679184641"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1342"></span><span>
</span><span id="line-1343"></span><span class="hs-comment">{--------------------------------------------------------------------
  Mapping
--------------------------------------------------------------------}</span><span>
</span><span id="line-1346"></span><span class="hs-comment">-- | /O(n)/. Map a function over all values in the map.</span><span>
</span><span id="line-1347"></span><span class="hs-comment">--</span><span>
</span><span id="line-1348"></span><span class="hs-comment">-- &gt; map (++ &quot;x&quot;) (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;bx&quot;), (5, &quot;ax&quot;)]</span><span>
</span><span id="line-1349"></span><span>
</span><span id="line-1350"></span><span id="local-6989586621679185656"><span id="local-6989586621679185657"><span id="local-6989586621679185658"><span class="annot"><a href="Data.Map.Strict.Internal.html#map"><span class="hs-identifier hs-type">map</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185658"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185657"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185656"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185658"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185656"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185657"><span class="hs-identifier hs-type">b</span></a></span></span></span></span><span>
</span><span id="line-1351"></span><span id="map"><span class="annot"><span class="annottext">map :: forall a b k. (a -&gt; b) -&gt; Map k a -&gt; Map k b
</span><a href="Data.Map.Strict.Internal.html#map"><span class="hs-identifier hs-var hs-var">map</span></a></span></span><span> </span><span id="local-6989586621679184634"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679184634"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; Map k b
forall {k}. Map k a -&gt; Map k b
</span><a href="#local-6989586621679184633"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-1352"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1353"></span><span>    </span><span id="local-6989586621679184633"><span class="annot"><span class="annottext">go :: Map k a -&gt; Map k b
</span><a href="#local-6989586621679184633"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k b
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1354"></span><span>    </span><span class="annot"><a href="#local-6989586621679184633"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679184632"><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679184632"><span class="hs-identifier hs-var">sx</span></a></span></span><span> </span><span id="local-6989586621679184631"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184631"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679184630"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184630"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679184629"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184629"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679184628"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184628"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679184627"><span class="annot"><span class="annottext">x' :: b
</span><a href="#local-6989586621679184627"><span class="hs-identifier hs-var hs-var">x'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679184634"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184630"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Size -&gt; k -&gt; b -&gt; Map k b -&gt; Map k b -&gt; Map k b
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679184632"><span class="hs-identifier hs-var">sx</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184631"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679184627"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Map k a -&gt; Map k b
</span><a href="#local-6989586621679184633"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184629"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Map k a -&gt; Map k b
</span><a href="#local-6989586621679184633"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184628"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1355"></span><span class="hs-comment">-- We use `go` to let `map` inline. This is important if `f` is a constant</span><span>
</span><span id="line-1356"></span><span class="hs-comment">-- function.</span><span class="hs-cpp">

#ifdef __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#map"><span class="hs-pragma hs-type">map</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1360"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-1361"></span><span class="annot"><span class="hs-pragma">&quot;map/map&quot;</span></span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679184626"><span class="annot"><a href="#local-6989586621679184626"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184625"><span class="annot"><a href="#local-6989586621679184625"><span class="hs-pragma hs-var">g</span></a></span></span><span> </span><span id="local-6989586621679184624"><span class="annot"><a href="#local-6989586621679184624"><span class="hs-pragma hs-var">xs</span></a></span></span><span> </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#map"><span class="hs-pragma hs-type">map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184626"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Map.Strict.Internal.html#map"><span class="hs-pragma hs-type">map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184625"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184624"><span class="hs-pragma hs-type">xs</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#map"><span class="hs-pragma hs-type">map</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679184623"><span class="annot"><a href="#local-6989586621679184623"><span class="hs-pragma hs-var">x</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679184626"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-pragma hs-type">$!</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184625"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184623"><span class="hs-pragma hs-type">x</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679184624"><span class="hs-pragma hs-type">xs</span></a></span><span>
</span><span id="line-1362"></span><span class="annot"><span class="hs-pragma">&quot;map/mapL&quot;</span></span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679184622"><span class="annot"><a href="#local-6989586621679184622"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184621"><span class="annot"><a href="#local-6989586621679184621"><span class="hs-pragma hs-var">g</span></a></span></span><span> </span><span id="local-6989586621679184620"><span class="annot"><a href="#local-6989586621679184620"><span class="hs-pragma hs-var">xs</span></a></span></span><span> </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#map"><span class="hs-pragma hs-type">map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184622"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Map.Internal.html#map"><span class="hs-pragma hs-type">L.map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184621"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184620"><span class="hs-pragma hs-type">xs</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#map"><span class="hs-pragma hs-type">map</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679184618"><span class="annot"><a href="#local-6989586621679184618"><span class="hs-pragma hs-var">x</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679184622"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="#local-6989586621679184621"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184618"><span class="hs-pragma hs-type">x</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679184620"><span class="hs-pragma hs-type">xs</span></a></span><span>
</span><span id="line-1363"></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1366"></span><span class="hs-comment">-- | /O(n)/. Map a function over all values in the map.</span><span>
</span><span id="line-1367"></span><span class="hs-comment">--</span><span>
</span><span id="line-1368"></span><span class="hs-comment">-- &gt; let f key x = (show key) ++ &quot;:&quot; ++ x</span><span>
</span><span id="line-1369"></span><span class="hs-comment">-- &gt; mapWithKey f (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == fromList [(3, &quot;3:b&quot;), (5, &quot;5:a&quot;)]</span><span>
</span><span id="line-1370"></span><span>
</span><span id="line-1371"></span><span id="local-6989586621679185568"><span id="local-6989586621679185569"><span id="local-6989586621679185570"><span class="annot"><a href="Data.Map.Strict.Internal.html#mapWithKey"><span class="hs-identifier hs-type">mapWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185570"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185569"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185568"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185570"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185569"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185570"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185568"><span class="hs-identifier hs-type">b</span></a></span></span></span></span><span>
</span><span id="line-1372"></span><span id="mapWithKey"><span class="annot"><span class="annottext">mapWithKey :: forall k a b. (k -&gt; a -&gt; b) -&gt; Map k a -&gt; Map k b
</span><a href="Data.Map.Strict.Internal.html#mapWithKey"><span class="hs-identifier hs-var hs-var">mapWithKey</span></a></span></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; b
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k b
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1373"></span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapWithKey"><span class="hs-identifier hs-var">mapWithKey</span></a></span><span> </span><span id="local-6989586621679184617"><span class="annot"><span class="annottext">k -&gt; a -&gt; b
</span><a href="#local-6989586621679184617"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679184616"><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679184616"><span class="hs-identifier hs-var">sx</span></a></span></span><span> </span><span id="local-6989586621679184615"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184615"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679184614"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184614"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679184613"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184613"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679184612"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184612"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1374"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679184611"><span class="annot"><span class="annottext">x' :: b
</span><a href="#local-6989586621679184611"><span class="hs-identifier hs-var hs-var">x'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; b
</span><a href="#local-6989586621679184617"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184615"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184614"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-1375"></span><span>  </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679184611"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; Map k b -&gt; Map k b
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">Size -&gt; k -&gt; b -&gt; Map k b -&gt; Map k b -&gt; Map k b
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679184616"><span class="hs-identifier hs-var">sx</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184615"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679184611"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(k -&gt; a -&gt; b) -&gt; Map k a -&gt; Map k b
forall k a b. (k -&gt; a -&gt; b) -&gt; Map k a -&gt; Map k b
</span><a href="Data.Map.Strict.Internal.html#mapWithKey"><span class="hs-identifier hs-var">mapWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; b
</span><a href="#local-6989586621679184617"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184613"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(k -&gt; a -&gt; b) -&gt; Map k a -&gt; Map k b
forall k a b. (k -&gt; a -&gt; b) -&gt; Map k a -&gt; Map k b
</span><a href="Data.Map.Strict.Internal.html#mapWithKey"><span class="hs-identifier hs-var">mapWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; b
</span><a href="#local-6989586621679184617"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184612"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span class="hs-cpp">

#ifdef __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapWithKey"><span class="hs-pragma hs-type">mapWithKey</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1379"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-1380"></span><span class="annot"><span class="hs-pragma">&quot;mapWithKey/mapWithKey&quot;</span></span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679184610"><span class="annot"><a href="#local-6989586621679184610"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184609"><span class="annot"><a href="#local-6989586621679184609"><span class="hs-pragma hs-var">g</span></a></span></span><span> </span><span id="local-6989586621679184608"><span class="annot"><a href="#local-6989586621679184608"><span class="hs-pragma hs-var">xs</span></a></span></span><span> </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapWithKey"><span class="hs-pragma hs-type">mapWithKey</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184610"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapWithKey"><span class="hs-pragma hs-type">mapWithKey</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184609"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184608"><span class="hs-pragma hs-type">xs</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span>
</span><span id="line-1381"></span><span>  </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapWithKey"><span class="hs-pragma hs-type">mapWithKey</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679184607"><span class="annot"><a href="#local-6989586621679184607"><span class="hs-pragma hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679184606"><span class="annot"><a href="#local-6989586621679184606"><span class="hs-pragma hs-var">a</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679184610"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184607"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-pragma hs-type">$!</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184609"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184607"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184606"><span class="hs-pragma hs-type">a</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679184608"><span class="hs-pragma hs-type">xs</span></a></span><span>
</span><span id="line-1382"></span><span class="annot"><span class="hs-pragma">&quot;mapWithKey/mapWithKeyL&quot;</span></span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679184605"><span class="annot"><a href="#local-6989586621679184605"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184604"><span class="annot"><a href="#local-6989586621679184604"><span class="hs-pragma hs-var">g</span></a></span></span><span> </span><span id="local-6989586621679184603"><span class="annot"><a href="#local-6989586621679184603"><span class="hs-pragma hs-var">xs</span></a></span></span><span> </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapWithKey"><span class="hs-pragma hs-type">mapWithKey</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184605"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Map.Internal.html#mapWithKey"><span class="hs-pragma hs-type">L.mapWithKey</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184604"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184603"><span class="hs-pragma hs-type">xs</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span>
</span><span id="line-1383"></span><span>  </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapWithKey"><span class="hs-pragma hs-type">mapWithKey</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679184601"><span class="annot"><a href="#local-6989586621679184601"><span class="hs-pragma hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679184600"><span class="annot"><a href="#local-6989586621679184600"><span class="hs-pragma hs-var">a</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679184605"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184601"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="#local-6989586621679184604"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184601"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184600"><span class="hs-pragma hs-type">a</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679184603"><span class="hs-pragma hs-type">xs</span></a></span><span>
</span><span id="line-1384"></span><span class="annot"><span class="hs-pragma">&quot;mapWithKey/map&quot;</span></span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679184599"><span class="annot"><a href="#local-6989586621679184599"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184598"><span class="annot"><a href="#local-6989586621679184598"><span class="hs-pragma hs-var">g</span></a></span></span><span> </span><span id="local-6989586621679184597"><span class="annot"><a href="#local-6989586621679184597"><span class="hs-pragma hs-var">xs</span></a></span></span><span> </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapWithKey"><span class="hs-pragma hs-type">mapWithKey</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184599"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Map.Strict.Internal.html#map"><span class="hs-pragma hs-type">map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184598"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184597"><span class="hs-pragma hs-type">xs</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span>
</span><span id="line-1385"></span><span>  </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapWithKey"><span class="hs-pragma hs-type">mapWithKey</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679184596"><span class="annot"><a href="#local-6989586621679184596"><span class="hs-pragma hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679184595"><span class="annot"><a href="#local-6989586621679184595"><span class="hs-pragma hs-var">a</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679184599"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184596"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-pragma hs-type">$!</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184598"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184595"><span class="hs-pragma hs-type">a</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679184597"><span class="hs-pragma hs-type">xs</span></a></span><span>
</span><span id="line-1386"></span><span class="annot"><span class="hs-pragma">&quot;mapWithKey/mapL&quot;</span></span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679184594"><span class="annot"><a href="#local-6989586621679184594"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184593"><span class="annot"><a href="#local-6989586621679184593"><span class="hs-pragma hs-var">g</span></a></span></span><span> </span><span id="local-6989586621679184592"><span class="annot"><a href="#local-6989586621679184592"><span class="hs-pragma hs-var">xs</span></a></span></span><span> </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapWithKey"><span class="hs-pragma hs-type">mapWithKey</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184594"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Map.Internal.html#map"><span class="hs-pragma hs-type">L.map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184593"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184592"><span class="hs-pragma hs-type">xs</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span>
</span><span id="line-1387"></span><span>  </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapWithKey"><span class="hs-pragma hs-type">mapWithKey</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679184591"><span class="annot"><a href="#local-6989586621679184591"><span class="hs-pragma hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679184590"><span class="annot"><a href="#local-6989586621679184590"><span class="hs-pragma hs-var">a</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679184594"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184591"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="#local-6989586621679184593"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184590"><span class="hs-pragma hs-type">a</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679184592"><span class="hs-pragma hs-type">xs</span></a></span><span>
</span><span id="line-1388"></span><span class="annot"><span class="hs-pragma">&quot;map/mapWithKey&quot;</span></span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679184589"><span class="annot"><a href="#local-6989586621679184589"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184588"><span class="annot"><a href="#local-6989586621679184588"><span class="hs-pragma hs-var">g</span></a></span></span><span> </span><span id="local-6989586621679184587"><span class="annot"><a href="#local-6989586621679184587"><span class="hs-pragma hs-var">xs</span></a></span></span><span> </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#map"><span class="hs-pragma hs-type">map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184589"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapWithKey"><span class="hs-pragma hs-type">mapWithKey</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184588"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184587"><span class="hs-pragma hs-type">xs</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span>
</span><span id="line-1389"></span><span>  </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapWithKey"><span class="hs-pragma hs-type">mapWithKey</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679184586"><span class="annot"><a href="#local-6989586621679184586"><span class="hs-pragma hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679184585"><span class="annot"><a href="#local-6989586621679184585"><span class="hs-pragma hs-var">a</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679184589"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-pragma hs-type">$!</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184588"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184586"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184585"><span class="hs-pragma hs-type">a</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679184587"><span class="hs-pragma hs-type">xs</span></a></span><span>
</span><span id="line-1390"></span><span class="annot"><span class="hs-pragma">&quot;map/mapWithKeyL&quot;</span></span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679184584"><span class="annot"><a href="#local-6989586621679184584"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184583"><span class="annot"><a href="#local-6989586621679184583"><span class="hs-pragma hs-var">g</span></a></span></span><span> </span><span id="local-6989586621679184582"><span class="annot"><a href="#local-6989586621679184582"><span class="hs-pragma hs-var">xs</span></a></span></span><span> </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#map"><span class="hs-pragma hs-type">map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184584"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Map.Internal.html#mapWithKey"><span class="hs-pragma hs-type">L.mapWithKey</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184583"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184582"><span class="hs-pragma hs-type">xs</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span>
</span><span id="line-1391"></span><span>  </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapWithKey"><span class="hs-pragma hs-type">mapWithKey</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679184581"><span class="annot"><a href="#local-6989586621679184581"><span class="hs-pragma hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679184580"><span class="annot"><a href="#local-6989586621679184580"><span class="hs-pragma hs-var">a</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679184584"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="#local-6989586621679184583"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184581"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184580"><span class="hs-pragma hs-type">a</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679184582"><span class="hs-pragma hs-type">xs</span></a></span><span>
</span><span id="line-1392"></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1395"></span><span class="hs-comment">-- | /O(n)/.</span><span>
</span><span id="line-1396"></span><span class="hs-comment">-- @'traverseWithKey' f m == 'fromList' &lt;$&gt; 'traverse' (\(k, v) -&gt; (\v' -&gt; v' \`seq\` (k,v')) &lt;$&gt; f k v) ('toList' m)@</span><span>
</span><span id="line-1397"></span><span class="hs-comment">-- That is, it behaves much like a regular 'traverse' except that the traversing</span><span>
</span><span id="line-1398"></span><span class="hs-comment">-- function also has access to the key associated with a value and the values are</span><span>
</span><span id="line-1399"></span><span class="hs-comment">-- forced before they are installed in the result map.</span><span>
</span><span id="line-1400"></span><span class="hs-comment">--</span><span>
</span><span id="line-1401"></span><span class="hs-comment">-- &gt; traverseWithKey (\k v -&gt; if odd k then Just (succ v) else Nothing) (fromList [(1, 'a'), (5, 'e')]) == Just (fromList [(1, 'b'), (5, 'f')])</span><span>
</span><span id="line-1402"></span><span class="hs-comment">-- &gt; traverseWithKey (\k v -&gt; if odd k then Just (succ v) else Nothing) (fromList [(2, 'c')])           == Nothing</span><span>
</span><span id="line-1403"></span><span id="local-6989586621679185544"><span id="local-6989586621679185545"><span id="local-6989586621679185546"><span id="local-6989586621679185547"><span class="annot"><a href="Data.Map.Strict.Internal.html#traverseWithKey"><span class="hs-identifier hs-type">traverseWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier hs-type">Applicative</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185547"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185546"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185545"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185547"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185544"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185546"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185545"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185547"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185546"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185544"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span></span></span></span></span><span>
</span><span id="line-1404"></span><span id="traverseWithKey"><span class="annot"><span class="annottext">traverseWithKey :: forall (t :: * -&gt; *) k a b.
Applicative t =&gt;
(k -&gt; a -&gt; t b) -&gt; Map k a -&gt; t (Map k b)
</span><a href="Data.Map.Strict.Internal.html#traverseWithKey"><span class="hs-identifier hs-var hs-var">traverseWithKey</span></a></span></span><span> </span><span id="local-6989586621679184577"><span class="annot"><span class="annottext">k -&gt; a -&gt; t b
</span><a href="#local-6989586621679184577"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; t (Map k b)
</span><a href="#local-6989586621679184576"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-1405"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1406"></span><span>    </span><span id="local-6989586621679184576"><span class="annot"><span class="annottext">go :: Map k a -&gt; t (Map k b)
</span><a href="#local-6989586621679184576"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k b -&gt; t (Map k b)
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">Map k b
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1407"></span><span>    </span><span class="annot"><a href="#local-6989586621679184576"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-number">1</span></span><span> </span><span id="local-6989586621679184569"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184569"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679184568"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184568"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679184567"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679184567"><span class="hs-identifier hs-var">v'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Size -&gt; k -&gt; b -&gt; Map k b -&gt; Map k b -&gt; Map k b
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184569"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679184567"><span class="hs-identifier hs-var">v'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k b
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Map k b
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(b -&gt; Map k b) -&gt; t b -&gt; t (Map k b)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; t b
</span><a href="#local-6989586621679184577"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184569"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184568"><span class="hs-identifier hs-var">v</span></a></span><span>
</span><span id="line-1408"></span><span>    </span><span class="annot"><a href="#local-6989586621679184576"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679184566"><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679184566"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679184565"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184565"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679184564"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184564"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span id="local-6989586621679184563"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184563"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679184562"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184562"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Map k b -&gt; b -&gt; Map k b -&gt; Map k b)
-&gt; t (Map k b) -&gt; t b -&gt; t (Map k b) -&gt; t (Map k b)
forall (f :: * -&gt; *) a b c d.
Applicative f =&gt;
(a -&gt; b -&gt; c -&gt; d) -&gt; f a -&gt; f b -&gt; f c -&gt; f d
</span><a href="../../base/src/GHC.Base.html#liftA3"><span class="hs-identifier hs-var">liftA3</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679184561"><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184561"><span class="hs-identifier hs-var">l'</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679184560"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679184560"><span class="hs-identifier hs-var">v'</span></a></span></span><span> </span><span id="local-6989586621679184559"><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184559"><span class="hs-identifier hs-var">r'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Size -&gt; k -&gt; b -&gt; Map k b -&gt; Map k b -&gt; Map k b
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679184566"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184565"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679184560"><span class="hs-identifier hs-var">v'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184561"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184559"><span class="hs-identifier hs-var">r'</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Map k a -&gt; t (Map k b)
</span><a href="#local-6989586621679184576"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184563"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k -&gt; a -&gt; t b
</span><a href="#local-6989586621679184577"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184565"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184564"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Map k a -&gt; t (Map k b)
</span><a href="#local-6989586621679184576"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184562"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1409"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#traverseWithKey"><span class="hs-pragma hs-type">traverseWithKey</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1410"></span><span>
</span><span id="line-1411"></span><span class="hs-comment">-- | /O(n)/. The function 'mapAccum' threads an accumulating</span><span>
</span><span id="line-1412"></span><span class="hs-comment">-- argument through the map in ascending order of keys.</span><span>
</span><span id="line-1413"></span><span class="hs-comment">--</span><span>
</span><span id="line-1414"></span><span class="hs-comment">-- &gt; let f a b = (a ++ b, b ++ &quot;X&quot;)</span><span>
</span><span id="line-1415"></span><span class="hs-comment">-- &gt; mapAccum f &quot;Everything: &quot; (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == (&quot;Everything: ba&quot;, fromList [(3, &quot;bX&quot;), (5, &quot;aX&quot;)])</span><span>
</span><span id="line-1416"></span><span>
</span><span id="line-1417"></span><span id="local-6989586621679185477"><span id="local-6989586621679185478"><span id="local-6989586621679185479"><span id="local-6989586621679185480"><span class="annot"><a href="Data.Map.Strict.Internal.html#mapAccum"><span class="hs-identifier hs-type">mapAccum</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185480"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185479"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185480"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679185478"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185480"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185477"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185479"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185480"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185477"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185478"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span></span></span></span></span><span>
</span><span id="line-1418"></span><span id="mapAccum"><span class="annot"><span class="annottext">mapAccum :: forall a b c k. (a -&gt; b -&gt; (a, c)) -&gt; a -&gt; Map k b -&gt; (a, Map k c)
</span><a href="Data.Map.Strict.Internal.html#mapAccum"><span class="hs-identifier hs-var hs-var">mapAccum</span></a></span></span><span> </span><span id="local-6989586621679184558"><span class="annot"><span class="annottext">a -&gt; b -&gt; (a, c)
</span><a href="#local-6989586621679184558"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184557"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184557"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679184556"><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184556"><span class="hs-identifier hs-var">m</span></a></span></span><span>
</span><span id="line-1419"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; k -&gt; b -&gt; (a, c)) -&gt; a -&gt; Map k b -&gt; (a, Map k c)
forall a k b c.
(a -&gt; k -&gt; b -&gt; (a, c)) -&gt; a -&gt; Map k b -&gt; (a, Map k c)
</span><a href="Data.Map.Strict.Internal.html#mapAccumWithKey"><span class="hs-identifier hs-var">mapAccumWithKey</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679184555"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184555"><span class="hs-identifier hs-var">a'</span></a></span></span><span> </span><span class="annot"><span class="annottext">k
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184554"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679184554"><span class="hs-identifier hs-var">x'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; (a, c)
</span><a href="#local-6989586621679184558"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184555"><span class="hs-identifier hs-var">a'</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679184554"><span class="hs-identifier hs-var">x'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184557"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184556"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-1420"></span><span>
</span><span id="line-1421"></span><span class="hs-comment">-- | /O(n)/. The function 'mapAccumWithKey' threads an accumulating</span><span>
</span><span id="line-1422"></span><span class="hs-comment">-- argument through the map in ascending order of keys.</span><span>
</span><span id="line-1423"></span><span class="hs-comment">--</span><span>
</span><span id="line-1424"></span><span class="hs-comment">-- &gt; let f a k b = (a ++ &quot; &quot; ++ (show k) ++ &quot;-&quot; ++ b, b ++ &quot;X&quot;)</span><span>
</span><span id="line-1425"></span><span class="hs-comment">-- &gt; mapAccumWithKey f &quot;Everything:&quot; (fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]) == (&quot;Everything: 3-b 5-a&quot;, fromList [(3, &quot;bX&quot;), (5, &quot;aX&quot;)])</span><span>
</span><span id="line-1426"></span><span>
</span><span id="line-1427"></span><span id="local-6989586621679185469"><span id="local-6989586621679185470"><span id="local-6989586621679185471"><span id="local-6989586621679185472"><span class="annot"><a href="Data.Map.Strict.Internal.html#mapAccumWithKey"><span class="hs-identifier hs-type">mapAccumWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185472"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185471"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185470"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185472"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679185469"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185472"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185471"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185470"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185472"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185471"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185469"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span></span></span></span></span><span>
</span><span id="line-1428"></span><span id="mapAccumWithKey"><span class="annot"><span class="annottext">mapAccumWithKey :: forall a k b c.
(a -&gt; k -&gt; b -&gt; (a, c)) -&gt; a -&gt; Map k b -&gt; (a, Map k c)
</span><a href="Data.Map.Strict.Internal.html#mapAccumWithKey"><span class="hs-identifier hs-var hs-var">mapAccumWithKey</span></a></span></span><span> </span><span id="local-6989586621679184553"><span class="annot"><span class="annottext">a -&gt; k -&gt; b -&gt; (a, c)
</span><a href="#local-6989586621679184553"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184552"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184552"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679184551"><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184551"><span class="hs-identifier hs-var">t</span></a></span></span><span>
</span><span id="line-1429"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; k -&gt; b -&gt; (a, c)) -&gt; a -&gt; Map k b -&gt; (a, Map k c)
forall a k b c.
(a -&gt; k -&gt; b -&gt; (a, c)) -&gt; a -&gt; Map k b -&gt; (a, Map k c)
</span><a href="Data.Map.Strict.Internal.html#mapAccumL"><span class="hs-identifier hs-var">mapAccumL</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; k -&gt; b -&gt; (a, c)
</span><a href="#local-6989586621679184553"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184552"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184551"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1430"></span><span>
</span><span id="line-1431"></span><span class="hs-comment">-- | /O(n)/. The function 'mapAccumL' threads an accumulating</span><span>
</span><span id="line-1432"></span><span class="hs-comment">-- argument through the map in ascending order of keys.</span><span>
</span><span id="line-1433"></span><span id="local-6989586621679184546"><span id="local-6989586621679184547"><span id="local-6989586621679184548"><span id="local-6989586621679184549"><span class="annot"><a href="Data.Map.Strict.Internal.html#mapAccumL"><span class="hs-identifier hs-type">mapAccumL</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679184549"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679184548"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679184547"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679184549"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679184546"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679184549"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184548"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184547"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679184549"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184548"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184546"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span></span></span></span></span><span>
</span><span id="line-1434"></span><span id="mapAccumL"><span class="annot"><span class="annottext">mapAccumL :: forall a k b c.
(a -&gt; k -&gt; b -&gt; (a, c)) -&gt; a -&gt; Map k b -&gt; (a, Map k c)
</span><a href="Data.Map.Strict.Internal.html#mapAccumL"><span class="hs-identifier hs-var hs-var">mapAccumL</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; k -&gt; b -&gt; (a, c)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184545"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184545"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k b
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184545"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Map k c
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1435"></span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapAccumL"><span class="hs-identifier hs-var">mapAccumL</span></a></span><span> </span><span id="local-6989586621679184544"><span class="annot"><span class="annottext">a -&gt; k -&gt; b -&gt; (a, c)
</span><a href="#local-6989586621679184544"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184543"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184543"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679184542"><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679184542"><span class="hs-identifier hs-var">sx</span></a></span></span><span> </span><span id="local-6989586621679184541"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184541"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679184540"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679184540"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679184539"><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184539"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679184538"><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184538"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1436"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679184537"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184537"><span class="hs-identifier hs-var">a1</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679184536"><span class="annot"><span class="annottext">Map k c
</span><a href="#local-6989586621679184536"><span class="hs-identifier hs-var">l'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; k -&gt; b -&gt; (a, c)) -&gt; a -&gt; Map k b -&gt; (a, Map k c)
forall a k b c.
(a -&gt; k -&gt; b -&gt; (a, c)) -&gt; a -&gt; Map k b -&gt; (a, Map k c)
</span><a href="Data.Map.Strict.Internal.html#mapAccumL"><span class="hs-identifier hs-var">mapAccumL</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; k -&gt; b -&gt; (a, c)
</span><a href="#local-6989586621679184544"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184543"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184539"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1437"></span><span>      </span><span class="hs-special">(</span><span id="local-6989586621679184535"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184535"><span class="hs-identifier hs-var">a2</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679184534"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679184534"><span class="hs-identifier hs-var">x'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; k -&gt; b -&gt; (a, c)
</span><a href="#local-6989586621679184544"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184537"><span class="hs-identifier hs-var">a1</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184541"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679184540"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-1438"></span><span>      </span><span class="hs-special">(</span><span id="local-6989586621679184533"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184533"><span class="hs-identifier hs-var">a3</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679184532"><span class="annot"><span class="annottext">Map k c
</span><a href="#local-6989586621679184532"><span class="hs-identifier hs-var">r'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; k -&gt; b -&gt; (a, c)) -&gt; a -&gt; Map k b -&gt; (a, Map k c)
forall a k b c.
(a -&gt; k -&gt; b -&gt; (a, c)) -&gt; a -&gt; Map k b -&gt; (a, Map k c)
</span><a href="Data.Map.Strict.Internal.html#mapAccumL"><span class="hs-identifier hs-var">mapAccumL</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; k -&gt; b -&gt; (a, c)
</span><a href="#local-6989586621679184544"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184535"><span class="hs-identifier hs-var">a2</span></a></span><span> </span><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184538"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1439"></span><span>  </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679184534"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">c -&gt; (a, Map k c) -&gt; (a, Map k c)
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184533"><span class="hs-identifier hs-var">a3</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Size -&gt; k -&gt; c -&gt; Map k c -&gt; Map k c -&gt; Map k c
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679184542"><span class="hs-identifier hs-var">sx</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184541"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679184534"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k c
</span><a href="#local-6989586621679184536"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k c
</span><a href="#local-6989586621679184532"><span class="hs-identifier hs-var">r'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1440"></span><span>
</span><span id="line-1441"></span><span class="hs-comment">-- | /O(n)/. The function 'mapAccumRWithKey' threads an accumulating</span><span>
</span><span id="line-1442"></span><span class="hs-comment">-- argument through the map in descending order of keys.</span><span>
</span><span id="line-1443"></span><span id="local-6989586621679184528"><span id="local-6989586621679184529"><span id="local-6989586621679184530"><span id="local-6989586621679184531"><span class="annot"><a href="Data.Map.Strict.Internal.html#mapAccumRWithKey"><span class="hs-identifier hs-type">mapAccumRWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679184531"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679184530"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679184529"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679184531"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679184528"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679184531"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184530"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184529"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679184531"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184530"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184528"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span></span></span></span></span><span>
</span><span id="line-1444"></span><span id="mapAccumRWithKey"><span class="annot"><span class="annottext">mapAccumRWithKey :: forall a k b c.
(a -&gt; k -&gt; b -&gt; (a, c)) -&gt; a -&gt; Map k b -&gt; (a, Map k c)
</span><a href="Data.Map.Strict.Internal.html#mapAccumRWithKey"><span class="hs-identifier hs-var hs-var">mapAccumRWithKey</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; k -&gt; b -&gt; (a, c)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184527"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184527"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="annot"><span class="annottext">Map k b
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184527"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Map k c
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1445"></span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapAccumRWithKey"><span class="hs-identifier hs-var">mapAccumRWithKey</span></a></span><span> </span><span id="local-6989586621679184526"><span class="annot"><span class="annottext">a -&gt; k -&gt; b -&gt; (a, c)
</span><a href="#local-6989586621679184526"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184525"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184525"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-type">Bin</span></a></span><span> </span><span id="local-6989586621679184524"><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679184524"><span class="hs-identifier hs-var">sx</span></a></span></span><span> </span><span id="local-6989586621679184523"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184523"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span id="local-6989586621679184522"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679184522"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679184521"><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184521"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679184520"><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184520"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1446"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679184519"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184519"><span class="hs-identifier hs-var">a1</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679184518"><span class="annot"><span class="annottext">Map k c
</span><a href="#local-6989586621679184518"><span class="hs-identifier hs-var">r'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; k -&gt; b -&gt; (a, c)) -&gt; a -&gt; Map k b -&gt; (a, Map k c)
forall a k b c.
(a -&gt; k -&gt; b -&gt; (a, c)) -&gt; a -&gt; Map k b -&gt; (a, Map k c)
</span><a href="Data.Map.Strict.Internal.html#mapAccumRWithKey"><span class="hs-identifier hs-var">mapAccumRWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; k -&gt; b -&gt; (a, c)
</span><a href="#local-6989586621679184526"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184525"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184520"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1447"></span><span>      </span><span class="hs-special">(</span><span id="local-6989586621679184517"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184517"><span class="hs-identifier hs-var">a2</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679184516"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679184516"><span class="hs-identifier hs-var">x'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; k -&gt; b -&gt; (a, c)
</span><a href="#local-6989586621679184526"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184519"><span class="hs-identifier hs-var">a1</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184523"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679184522"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-1448"></span><span>      </span><span class="hs-special">(</span><span id="local-6989586621679184515"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184515"><span class="hs-identifier hs-var">a3</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679184514"><span class="annot"><span class="annottext">Map k c
</span><a href="#local-6989586621679184514"><span class="hs-identifier hs-var">l'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; k -&gt; b -&gt; (a, c)) -&gt; a -&gt; Map k b -&gt; (a, Map k c)
forall a k b c.
(a -&gt; k -&gt; b -&gt; (a, c)) -&gt; a -&gt; Map k b -&gt; (a, Map k c)
</span><a href="Data.Map.Strict.Internal.html#mapAccumRWithKey"><span class="hs-identifier hs-var">mapAccumRWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; k -&gt; b -&gt; (a, c)
</span><a href="#local-6989586621679184526"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184517"><span class="hs-identifier hs-var">a2</span></a></span><span> </span><span class="annot"><span class="annottext">Map k b
</span><a href="#local-6989586621679184521"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1449"></span><span>  </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679184516"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">c -&gt; (a, Map k c) -&gt; (a, Map k c)
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184515"><span class="hs-identifier hs-var">a3</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Size -&gt; k -&gt; c -&gt; Map k c -&gt; Map k c -&gt; Map k c
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679184524"><span class="hs-identifier hs-var">sx</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184523"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679184516"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k c
</span><a href="#local-6989586621679184514"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k c
</span><a href="#local-6989586621679184518"><span class="hs-identifier hs-var">r'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1450"></span><span>
</span><span id="line-1451"></span><span class="hs-comment">-- | /O(n*log n)/.</span><span>
</span><span id="line-1452"></span><span class="hs-comment">-- @'mapKeysWith' c f s@ is the map obtained by applying @f@ to each key of @s@.</span><span>
</span><span id="line-1453"></span><span class="hs-comment">--</span><span>
</span><span id="line-1454"></span><span class="hs-comment">-- The size of the result may be smaller if @f@ maps two or more distinct</span><span>
</span><span id="line-1455"></span><span class="hs-comment">-- keys to the same new key.  In this case the associated values will be</span><span>
</span><span id="line-1456"></span><span class="hs-comment">-- combined using @c@. The value at the greater of the two original keys</span><span>
</span><span id="line-1457"></span><span class="hs-comment">-- is used as the first argument to @c@.</span><span>
</span><span id="line-1458"></span><span class="hs-comment">--</span><span>
</span><span id="line-1459"></span><span class="hs-comment">-- &gt; mapKeysWith (++) (\ _ -&gt; 1) (fromList [(1,&quot;b&quot;), (2,&quot;a&quot;), (3,&quot;d&quot;), (4,&quot;c&quot;)]) == singleton 1 &quot;cdab&quot;</span><span>
</span><span id="line-1460"></span><span class="hs-comment">-- &gt; mapKeysWith (++) (\ _ -&gt; 3) (fromList [(1,&quot;b&quot;), (2,&quot;a&quot;), (3,&quot;d&quot;), (4,&quot;c&quot;)]) == singleton 3 &quot;cdab&quot;</span><span>
</span><span id="line-1461"></span><span>
</span><span id="line-1462"></span><span id="local-6989586621679185454"><span id="local-6989586621679185455"><span id="local-6989586621679185456"><span class="annot"><a href="Data.Map.Strict.Internal.html#mapKeysWith"><span class="hs-identifier hs-type">mapKeysWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185456"><span class="hs-identifier hs-type">k2</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185455"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185455"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185455"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185454"><span class="hs-identifier hs-type">k1</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621679185456"><span class="hs-identifier hs-type">k2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185454"><span class="hs-identifier hs-type">k1</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185455"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185456"><span class="hs-identifier hs-type">k2</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185455"><span class="hs-identifier hs-type">a</span></a></span></span></span></span><span>
</span><span id="line-1463"></span><span id="mapKeysWith"><span class="annot"><span class="annottext">mapKeysWith :: forall k2 a k1.
Ord k2 =&gt;
(a -&gt; a -&gt; a) -&gt; (k1 -&gt; k2) -&gt; Map k1 a -&gt; Map k2 a
</span><a href="Data.Map.Strict.Internal.html#mapKeysWith"><span class="hs-identifier hs-var hs-var">mapKeysWith</span></a></span></span><span> </span><span id="local-6989586621679184511"><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679184511"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679184510"><span class="annot"><span class="annottext">k1 -&gt; k2
</span><a href="#local-6989586621679184510"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; [(k2, a)] -&gt; Map k2 a
forall k a. Ord k =&gt; (a -&gt; a -&gt; a) -&gt; [(k, a)] -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#fromListWith"><span class="hs-identifier hs-var">fromListWith</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679184511"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">([(k2, a)] -&gt; Map k2 a)
-&gt; (Map k1 a -&gt; [(k2, a)]) -&gt; Map k1 a -&gt; Map k2 a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(k1 -&gt; a -&gt; [(k2, a)] -&gt; [(k2, a)])
-&gt; [(k2, a)] -&gt; Map k1 a -&gt; [(k2, a)]
forall k a b. (k -&gt; a -&gt; b -&gt; b) -&gt; b -&gt; Map k a -&gt; b
</span><a href="Data.Map.Internal.html#foldrWithKey"><span class="hs-identifier hs-var">foldrWithKey</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679184509"><span class="annot"><span class="annottext">k1
</span><a href="#local-6989586621679184509"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679184508"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184508"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679184507"><span class="annot"><span class="annottext">[(k2, a)]
</span><a href="#local-6989586621679184507"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k1 -&gt; k2
</span><a href="#local-6989586621679184510"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k1
</span><a href="#local-6989586621679184509"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184508"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(k2, a) -&gt; [(k2, a)] -&gt; [(k2, a)]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[(k2, a)]
</span><a href="#local-6989586621679184507"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#mapKeysWith"><span class="hs-pragma hs-type">mapKeysWith</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1468"></span><span class="hs-comment">{--------------------------------------------------------------------
  Conversions
--------------------------------------------------------------------}</span><span>
</span><span id="line-1471"></span><span>
</span><span id="line-1472"></span><span class="hs-comment">-- | /O(n)/. Build a map from a set of keys and a function which for each key</span><span>
</span><span id="line-1473"></span><span class="hs-comment">-- computes its value.</span><span>
</span><span id="line-1474"></span><span class="hs-comment">--</span><span>
</span><span id="line-1475"></span><span class="hs-comment">-- &gt; fromSet (\k -&gt; replicate k 'a') (Data.Set.fromList [3, 5]) == fromList [(5,&quot;aaaaa&quot;), (3,&quot;aaa&quot;)]</span><span>
</span><span id="line-1476"></span><span class="hs-comment">-- &gt; fromSet undefined Data.Set.empty == empty</span><span>
</span><span id="line-1477"></span><span>
</span><span id="line-1478"></span><span id="local-6989586621679185444"><span id="local-6989586621679185445"><span class="annot"><a href="Data.Map.Strict.Internal.html#fromSet"><span class="hs-identifier hs-type">fromSet</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185445"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185444"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Set.Internal.html#Set"><span class="hs-identifier hs-type">Set.Set</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185445"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185445"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185444"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-1479"></span><span id="fromSet"><span class="annot"><span class="annottext">fromSet :: forall k a. (k -&gt; a) -&gt; Set k -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#fromSet"><span class="hs-identifier hs-var hs-var">fromSet</span></a></span></span><span> </span><span class="annot"><span class="annottext">k -&gt; a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Set k
</span><a href="Data.Set.Internal.html#Tip"><span class="hs-identifier hs-var">Set.Tip</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1480"></span><span class="annot"><a href="Data.Map.Strict.Internal.html#fromSet"><span class="hs-identifier hs-var">fromSet</span></a></span><span> </span><span id="local-6989586621679184505"><span class="annot"><span class="annottext">k -&gt; a
</span><a href="#local-6989586621679184505"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Set.Internal.html#Bin"><span class="hs-identifier hs-type">Set.Bin</span></a></span><span> </span><span id="local-6989586621679184503"><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679184503"><span class="hs-identifier hs-var">sz</span></a></span></span><span> </span><span id="local-6989586621679184502"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184502"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679184501"><span class="annot"><span class="annottext">Set k
</span><a href="#local-6989586621679184501"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679184500"><span class="annot"><span class="annottext">Set k
</span><a href="#local-6989586621679184500"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">k -&gt; a
</span><a href="#local-6989586621679184505"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184502"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span> </span><span id="local-6989586621679184499"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184499"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184499"><span class="hs-identifier hs-var">v</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Map k a -&gt; Map k a
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679184503"><span class="hs-identifier hs-var">sz</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184502"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184499"><span class="hs-identifier hs-var">v</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(k -&gt; a) -&gt; Set k -&gt; Map k a
forall k a. (k -&gt; a) -&gt; Set k -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#fromSet"><span class="hs-identifier hs-var">fromSet</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a
</span><a href="#local-6989586621679184505"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Set k
</span><a href="#local-6989586621679184501"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(k -&gt; a) -&gt; Set k -&gt; Map k a
forall k a. (k -&gt; a) -&gt; Set k -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#fromSet"><span class="hs-identifier hs-var">fromSet</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a
</span><a href="#local-6989586621679184505"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Set k
</span><a href="#local-6989586621679184500"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1481"></span><span>
</span><span id="line-1482"></span><span class="hs-comment">{--------------------------------------------------------------------
  Lists
--------------------------------------------------------------------}</span><span>
</span><span id="line-1485"></span><span class="hs-comment">-- | /O(n*log n)/. Build a map from a list of key\/value pairs. See also 'fromAscList'.</span><span>
</span><span id="line-1486"></span><span class="hs-comment">-- If the list contains more than one value for the same key, the last value</span><span>
</span><span id="line-1487"></span><span class="hs-comment">-- for the key is retained.</span><span>
</span><span id="line-1488"></span><span class="hs-comment">--</span><span>
</span><span id="line-1489"></span><span class="hs-comment">-- If the keys of the list are ordered, linear-time implementation is used,</span><span>
</span><span id="line-1490"></span><span class="hs-comment">-- with the performance equal to 'fromDistinctAscList'.</span><span>
</span><span id="line-1491"></span><span class="hs-comment">--</span><span>
</span><span id="line-1492"></span><span class="hs-comment">-- &gt; fromList [] == empty</span><span>
</span><span id="line-1493"></span><span class="hs-comment">-- &gt; fromList [(5,&quot;a&quot;), (3,&quot;b&quot;), (5, &quot;c&quot;)] == fromList [(5,&quot;c&quot;), (3,&quot;b&quot;)]</span><span>
</span><span id="line-1494"></span><span class="hs-comment">-- &gt; fromList [(5,&quot;c&quot;), (3,&quot;b&quot;), (5, &quot;a&quot;)] == fromList [(5,&quot;a&quot;), (3,&quot;b&quot;)]</span><span>
</span><span id="line-1495"></span><span>
</span><span id="line-1496"></span><span class="hs-comment">-- For some reason, when 'singleton' is used in fromList or in</span><span>
</span><span id="line-1497"></span><span class="hs-comment">-- create, it is not inlined, so we inline it manually.</span><span>
</span><span id="line-1498"></span><span id="local-6989586621679185439"><span id="local-6989586621679185440"><span class="annot"><a href="Data.Map.Strict.Internal.html#fromList"><span class="hs-identifier hs-type">fromList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185440"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185440"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679185439"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185440"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185439"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-1499"></span><span id="fromList"><span class="annot"><span class="annottext">fromList :: forall k a. Ord k =&gt; [(k, a)] -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#fromList"><span class="hs-identifier hs-var hs-var">fromList</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1500"></span><span class="annot"><a href="Data.Map.Strict.Internal.html#fromList"><span class="hs-identifier hs-var">fromList</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span id="local-6989586621679184489"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184489"><span class="hs-identifier hs-var">kx</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184488"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184488"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184488"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Map k a -&gt; Map k a
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184489"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184488"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1501"></span><span class="annot"><a href="Data.Map.Strict.Internal.html#fromList"><span class="hs-identifier hs-var">fromList</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621679184487"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184487"><span class="hs-identifier hs-var">kx0</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184486"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184486"><span class="hs-identifier hs-var">x0</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679184485"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184485"><span class="hs-identifier hs-var">xs0</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">k -&gt; [(k, a)] -&gt; Bool
forall {a} {b}. Ord a =&gt; a -&gt; [(a, b)] -&gt; Bool
</span><a href="#local-6989586621679184484"><span class="hs-identifier hs-var">not_ordered</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184487"><span class="hs-identifier hs-var">kx0</span></a></span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184485"><span class="hs-identifier hs-var">xs0</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184486"><span class="hs-identifier hs-var">x0</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Map k a -&gt; Map k a
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; [(k, a)] -&gt; Map k a
forall {t :: * -&gt; *} {k} {a}.
(Foldable t, Ord k) =&gt;
Map k a -&gt; t (k, a) -&gt; Map k a
</span><a href="#local-6989586621679184483"><span class="hs-identifier hs-var">fromList'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184487"><span class="hs-identifier hs-var">kx0</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184486"><span class="hs-identifier hs-var">x0</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184485"><span class="hs-identifier hs-var">xs0</span></a></span><span>
</span><span id="line-1502"></span><span>                           </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184486"><span class="hs-identifier hs-var">x0</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Map k a -&gt; Map k a
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">Size -&gt; Map k a -&gt; [(k, a)] -&gt; Map k a
forall {k} {t} {a}.
(Ord k, Num t, Bits t) =&gt;
t -&gt; Map k a -&gt; [(k, a)] -&gt; Map k a
</span><a href="#local-6989586621679184482"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Size
</span><span class="hs-number">1</span></span><span class="hs-glyph">::</span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184487"><span class="hs-identifier hs-var">kx0</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184486"><span class="hs-identifier hs-var">x0</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184485"><span class="hs-identifier hs-var">xs0</span></a></span><span>
</span><span id="line-1503"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1504"></span><span>    </span><span id="local-6989586621679184484"><span class="annot"><span class="annottext">not_ordered :: a -&gt; [(a, b)] -&gt; Bool
</span><a href="#local-6989586621679184484"><span class="hs-identifier hs-var hs-var">not_ordered</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1505"></span><span>    </span><span class="annot"><a href="#local-6989586621679184484"><span class="hs-identifier hs-var">not_ordered</span></a></span><span> </span><span id="local-6989586621679184479"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184479"><span class="hs-identifier hs-var">kx</span></a></span></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621679184478"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184478"><span class="hs-identifier hs-var">ky</span></a></span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">b
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">[(a, b)]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184479"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;=</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184478"><span class="hs-identifier hs-var">ky</span></a></span><span>
</span><span id="line-1506"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="#local-6989586621679184484"><span class="hs-pragma hs-type">not_ordered</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1507"></span><span>
</span><span id="line-1508"></span><span>    </span><span id="local-6989586621679184483"><span class="annot"><span class="annottext">fromList' :: Map k a -&gt; t (k, a) -&gt; Map k a
</span><a href="#local-6989586621679184483"><span class="hs-identifier hs-var hs-var">fromList'</span></a></span></span><span> </span><span id="local-6989586621679184473"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184473"><span class="hs-identifier hs-var">t0</span></a></span></span><span> </span><span id="local-6989586621679184472"><span class="annot"><span class="annottext">t (k, a)
</span><a href="#local-6989586621679184472"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Map k a -&gt; (k, a) -&gt; Map k a) -&gt; Map k a -&gt; t (k, a) -&gt; Map k a
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">Foldable.foldl'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; (k, a) -&gt; Map k a
forall {k} {a}. Ord k =&gt; Map k a -&gt; (k, a) -&gt; Map k a
</span><a href="#local-6989586621679184471"><span class="hs-identifier hs-var">ins</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184473"><span class="hs-identifier hs-var">t0</span></a></span><span> </span><span class="annot"><span class="annottext">t (k, a)
</span><a href="#local-6989586621679184472"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-1509"></span><span>      </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679184471"><span class="annot"><span class="annottext">ins :: Map k a -&gt; (k, a) -&gt; Map k a
</span><a href="#local-6989586621679184471"><span class="hs-identifier hs-var hs-var">ins</span></a></span></span><span> </span><span id="local-6989586621679184468"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184468"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679184467"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184467"><span class="hs-identifier hs-var">k</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679184466"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184466"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a
forall k a. Ord k =&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#insert"><span class="hs-identifier hs-var">insert</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184467"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184466"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184468"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1510"></span><span>
</span><span id="line-1511"></span><span>    </span><span id="local-6989586621679184482"><span class="annot"><span class="annottext">go :: t -&gt; Map k a -&gt; [(k, a)] -&gt; Map k a
</span><a href="#local-6989586621679184482"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">t
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184453"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184453"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184453"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1512"></span><span>    </span><span class="annot"><a href="#local-6989586621679184482"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184452"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184452"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span id="local-6989586621679184451"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184451"><span class="hs-identifier hs-var">kx</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184450"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184450"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184450"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Map k a -&gt; Map k a
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#insertMax"><span class="hs-identifier hs-var">insertMax</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184451"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184450"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184452"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1513"></span><span>    </span><span class="annot"><a href="#local-6989586621679184482"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679184449"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679184449"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679184448"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184448"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621679184447"><span class="annot"><span class="annottext">xs :: [(k, a)]
</span><a href="#local-6989586621679184447"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621679184446"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184446"><span class="hs-identifier hs-var">kx</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184445"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184445"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679184444"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184444"><span class="hs-identifier hs-var">xss</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">k -&gt; [(k, a)] -&gt; Bool
forall {a} {b}. Ord a =&gt; a -&gt; [(a, b)] -&gt; Bool
</span><a href="#local-6989586621679184484"><span class="hs-identifier hs-var">not_ordered</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184446"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184444"><span class="hs-identifier hs-var">xss</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; [(k, a)] -&gt; Map k a
forall {t :: * -&gt; *} {k} {a}.
(Foldable t, Ord k) =&gt;
Map k a -&gt; t (k, a) -&gt; Map k a
</span><a href="#local-6989586621679184483"><span class="hs-identifier hs-var">fromList'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184448"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184447"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-1514"></span><span>                              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">t -&gt; [(k, a)] -&gt; (Map k a, [(k, a)], [(k, a)])
forall {a} {k} {a}.
(Num a, Ord k, Bits a) =&gt;
a -&gt; [(k, a)] -&gt; (Map k a, [(k, a)], [(k, a)])
</span><a href="#local-6989586621679184443"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679184449"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184444"><span class="hs-identifier hs-var">xss</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1515"></span><span>                                  </span><span class="hs-special">(</span><span id="local-6989586621679184442"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184442"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184441"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184441"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184445"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Map k a -&gt; Map k a
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">t -&gt; Map k a -&gt; [(k, a)] -&gt; Map k a
</span><a href="#local-6989586621679184482"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679184449"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">t -&gt; Size -&gt; t
forall a. Bits a =&gt; a -&gt; Size -&gt; a
</span><a href="../../base/src/Data.Bits.html#shiftL"><span class="hs-operator hs-var">`shiftL`</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184446"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184445"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184448"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184442"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184441"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-1516"></span><span>                                  </span><span class="hs-special">(</span><span id="local-6989586621679184440"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184440"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span>  </span><span id="local-6989586621679184439"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184439"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184445"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Map k a -&gt; Map k a
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; [(k, a)] -&gt; Map k a
forall {t :: * -&gt; *} {k} {a}.
(Foldable t, Ord k) =&gt;
Map k a -&gt; t (k, a) -&gt; Map k a
</span><a href="#local-6989586621679184483"><span class="hs-identifier hs-var">fromList'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184446"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184445"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184448"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184440"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184439"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-1517"></span><span>
</span><span id="line-1518"></span><span>    </span><span class="hs-comment">-- The create is returning a triple (tree, xs, ys). Both xs and ys</span><span>
</span><span id="line-1519"></span><span>    </span><span class="hs-comment">-- represent not yet processed elements and only one of them can be nonempty.</span><span>
</span><span id="line-1520"></span><span>    </span><span class="hs-comment">-- If ys is nonempty, the keys in ys are not ordered with respect to tree</span><span>
</span><span id="line-1521"></span><span>    </span><span class="hs-comment">-- and must be inserted using fromList'. Otherwise the keys have been</span><span>
</span><span id="line-1522"></span><span>    </span><span class="hs-comment">-- ordered so far.</span><span>
</span><span id="line-1523"></span><span>    </span><span id="local-6989586621679184443"><span class="annot"><span class="annottext">create :: a -&gt; [(k, a)] -&gt; (Map k a, [(k, a)], [(k, a)])
</span><a href="#local-6989586621679184443"><span class="hs-identifier hs-var hs-var">create</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1524"></span><span>    </span><span class="annot"><a href="#local-6989586621679184443"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span id="local-6989586621679184427"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184427"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679184426"><span class="annot"><span class="annottext">xs :: [(k, a)]
</span><a href="#local-6989586621679184426"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621679184425"><span class="annot"><span class="annottext">(k, a)
</span><a href="#local-6989586621679184425"><span class="hs-identifier hs-var">xp</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679184424"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184424"><span class="hs-identifier hs-var">xss</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1525"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184427"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">1</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">(k, a)
</span><a href="#local-6989586621679184425"><span class="hs-identifier hs-var">xp</span></a></span><span> </span><span class="hs-keyword">of</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679184423"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184423"><span class="hs-identifier hs-var">kx</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184422"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184422"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">k -&gt; [(k, a)] -&gt; Bool
forall {a} {b}. Ord a =&gt; a -&gt; [(a, b)] -&gt; Bool
</span><a href="#local-6989586621679184484"><span class="hs-identifier hs-var">not_ordered</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184423"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184424"><span class="hs-identifier hs-var">xss</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184422"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; (Map k a, [(k, a)], [(k, a)]) -&gt; (Map k a, [(k, a)], [(k, a)])
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184423"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184422"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184424"><span class="hs-identifier hs-var">xss</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1526"></span><span>                                    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184422"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; (Map k a, [(k, a)], [(k, a)]) -&gt; (Map k a, [(k, a)], [(k, a)])
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184423"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184422"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184424"><span class="hs-identifier hs-var">xss</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1527"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; [(k, a)] -&gt; (Map k a, [(k, a)], [(k, a)])
</span><a href="#local-6989586621679184443"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184427"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Size -&gt; a
forall a. Bits a =&gt; a -&gt; Size -&gt; a
</span><a href="../../base/src/Data.Bits.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184426"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1528"></span><span>                      </span><span id="local-6989586621679184421"><span class="annot"><span class="annottext">res :: (Map k a, [(k, a)], [(k, a)])
</span><a href="#local-6989586621679184421"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Map k a
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Map k a, [(k, a)], [(k, a)])
</span><a href="#local-6989586621679184421"><span class="hs-identifier hs-var">res</span></a></span><span>
</span><span id="line-1529"></span><span>                      </span><span class="hs-special">(</span><span id="local-6989586621679184420"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184420"><span class="hs-identifier hs-var">l</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span id="local-6989586621679184419"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184419"><span class="hs-identifier hs-var">ky</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184418"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184418"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184417"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184417"><span class="hs-identifier hs-var">zs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184418"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; (Map k a, [(k, a)], [(k, a)]) -&gt; (Map k a, [(k, a)], [(k, a)])
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#insertMax"><span class="hs-identifier hs-var">insertMax</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184419"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184418"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184420"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184417"><span class="hs-identifier hs-var">zs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1530"></span><span>                      </span><span class="hs-special">(</span><span id="local-6989586621679184416"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184416"><span class="hs-identifier hs-var">l</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184415"><span class="annot"><span class="annottext">ys :: [(k, a)]
</span><a href="#local-6989586621679184415"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621679184414"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184414"><span class="hs-identifier hs-var">ky</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184413"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184413"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679184412"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184412"><span class="hs-identifier hs-var">yss</span></a></span></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">k -&gt; [(k, a)] -&gt; Bool
forall {a} {b}. Ord a =&gt; a -&gt; [(a, b)] -&gt; Bool
</span><a href="#local-6989586621679184484"><span class="hs-identifier hs-var">not_ordered</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184414"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184412"><span class="hs-identifier hs-var">yss</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184416"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184415"><span class="hs-identifier hs-var">ys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1531"></span><span>                                               </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; [(k, a)] -&gt; (Map k a, [(k, a)], [(k, a)])
</span><a href="#local-6989586621679184443"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184427"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Size -&gt; a
forall a. Bits a =&gt; a -&gt; Size -&gt; a
</span><a href="../../base/src/Data.Bits.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184412"><span class="hs-identifier hs-var">yss</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1532"></span><span>                                                   </span><span class="hs-special">(</span><span id="local-6989586621679184411"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184411"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184410"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184410"><span class="hs-identifier hs-var">zs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184409"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184409"><span class="hs-identifier hs-var">ws</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184413"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; (Map k a, [(k, a)], [(k, a)]) -&gt; (Map k a, [(k, a)], [(k, a)])
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184414"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184413"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184416"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184411"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184410"><span class="hs-identifier hs-var">zs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184409"><span class="hs-identifier hs-var">ws</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#fromList"><span class="hs-pragma hs-type">fromList</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1537"></span><span class="hs-comment">-- | /O(n*log n)/. Build a map from a list of key\/value pairs with a combining function. See also 'fromAscListWith'.</span><span>
</span><span id="line-1538"></span><span class="hs-comment">--</span><span>
</span><span id="line-1539"></span><span class="hs-comment">-- &gt; fromListWith (++) [(5,&quot;a&quot;), (5,&quot;b&quot;), (3,&quot;b&quot;), (3,&quot;a&quot;), (5,&quot;a&quot;)] == fromList [(3, &quot;ab&quot;), (5, &quot;aba&quot;)]</span><span>
</span><span id="line-1540"></span><span class="hs-comment">-- &gt; fromListWith (++) [] == empty</span><span>
</span><span id="line-1541"></span><span>
</span><span id="line-1542"></span><span id="local-6989586621679185449"><span id="local-6989586621679185450"><span class="annot"><a href="Data.Map.Strict.Internal.html#fromListWith"><span class="hs-identifier hs-type">fromListWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185450"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185449"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185449"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185449"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185450"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679185449"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185450"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185449"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-1543"></span><span id="fromListWith"><span class="annot"><span class="annottext">fromListWith :: forall k a. Ord k =&gt; (a -&gt; a -&gt; a) -&gt; [(k, a)] -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#fromListWith"><span class="hs-identifier hs-var hs-var">fromListWith</span></a></span></span><span> </span><span id="local-6989586621679184406"><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679184406"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184405"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184405"><span class="hs-identifier hs-var">xs</span></a></span></span><span>
</span><span id="line-1544"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; a -&gt; a -&gt; a) -&gt; [(k, a)] -&gt; Map k a
forall k a. Ord k =&gt; (k -&gt; a -&gt; a -&gt; a) -&gt; [(k, a)] -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#fromListWithKey"><span class="hs-identifier hs-var">fromListWithKey</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">k
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184404"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184404"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679184403"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184403"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679184406"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184404"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184403"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184405"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#fromListWith"><span class="hs-pragma hs-type">fromListWith</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1549"></span><span class="hs-comment">-- | /O(n*log n)/. Build a map from a list of key\/value pairs with a combining function. See also 'fromAscListWithKey'.</span><span>
</span><span id="line-1550"></span><span class="hs-comment">--</span><span>
</span><span id="line-1551"></span><span class="hs-comment">-- &gt; let f k a1 a2 = (show k) ++ a1 ++ a2</span><span>
</span><span id="line-1552"></span><span class="hs-comment">-- &gt; fromListWithKey f [(5,&quot;a&quot;), (5,&quot;b&quot;), (3,&quot;b&quot;), (3,&quot;a&quot;), (5,&quot;a&quot;)] == fromList [(3, &quot;3ab&quot;), (5, &quot;5a5ba&quot;)]</span><span>
</span><span id="line-1553"></span><span class="hs-comment">-- &gt; fromListWithKey f [] == empty</span><span>
</span><span id="line-1554"></span><span>
</span><span id="line-1555"></span><span id="local-6989586621679185415"><span id="local-6989586621679185416"><span class="annot"><a href="Data.Map.Strict.Internal.html#fromListWithKey"><span class="hs-identifier hs-type">fromListWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Ord</span></span><span> </span><span class="annot"><a href="#local-6989586621679185416"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185416"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185415"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185415"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185415"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185416"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679185415"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185416"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185415"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-1556"></span><span id="fromListWithKey"><span class="annot"><span class="annottext">fromListWithKey :: forall k a. Ord k =&gt; (k -&gt; a -&gt; a -&gt; a) -&gt; [(k, a)] -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#fromListWithKey"><span class="hs-identifier hs-var hs-var">fromListWithKey</span></a></span></span><span> </span><span id="local-6989586621679184400"><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679184400"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184399"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184399"><span class="hs-identifier hs-var">xs</span></a></span></span><span>
</span><span id="line-1557"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Map k a -&gt; (k, a) -&gt; Map k a) -&gt; Map k a -&gt; [(k, a)] -&gt; Map k a
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">Foldable.foldl'</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; (k, a) -&gt; Map k a
</span><a href="#local-6989586621679184398"><span class="hs-identifier hs-var">ins</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184399"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-1558"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1559"></span><span>    </span><span id="local-6989586621679184398"><span class="annot"><span class="annottext">ins :: Map k a -&gt; (k, a) -&gt; Map k a
</span><a href="#local-6989586621679184398"><span class="hs-identifier hs-var hs-var">ins</span></a></span></span><span> </span><span id="local-6989586621679184396"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184396"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679184395"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184395"><span class="hs-identifier hs-var">k</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679184394"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184394"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
forall k a.
Ord k =&gt;
(k -&gt; a -&gt; a -&gt; a) -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#insertWithKey"><span class="hs-identifier hs-var">insertWithKey</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679184400"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184395"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184394"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184396"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#fromListWithKey"><span class="hs-pragma hs-type">fromListWithKey</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1564"></span><span class="hs-comment">{--------------------------------------------------------------------
  Building trees from ascending/descending lists can be done in linear time.

  Note that if [xs] is ascending then:
    fromAscList xs       == fromList xs
    fromAscListWith f xs == fromListWith f xs

  If [xs] is descending then:
    fromDescList xs       == fromList xs
    fromDescListWith f xs == fromListWith f xs
--------------------------------------------------------------------}</span><span>
</span><span id="line-1575"></span><span>
</span><span id="line-1576"></span><span class="hs-comment">-- | /O(n)/. Build a map from an ascending list in linear time.</span><span>
</span><span id="line-1577"></span><span class="hs-comment">-- /The precondition (input list is ascending) is not checked./</span><span>
</span><span id="line-1578"></span><span class="hs-comment">--</span><span>
</span><span id="line-1579"></span><span class="hs-comment">-- &gt; fromAscList [(3,&quot;b&quot;), (5,&quot;a&quot;)]          == fromList [(3, &quot;b&quot;), (5, &quot;a&quot;)]</span><span>
</span><span id="line-1580"></span><span class="hs-comment">-- &gt; fromAscList [(3,&quot;b&quot;), (5,&quot;a&quot;), (5,&quot;b&quot;)] == fromList [(3, &quot;b&quot;), (5, &quot;b&quot;)]</span><span>
</span><span id="line-1581"></span><span class="hs-comment">-- &gt; valid (fromAscList [(3,&quot;b&quot;), (5,&quot;a&quot;), (5,&quot;b&quot;)]) == True</span><span>
</span><span id="line-1582"></span><span class="hs-comment">-- &gt; valid (fromAscList [(5,&quot;a&quot;), (3,&quot;b&quot;), (5,&quot;b&quot;)]) == False</span><span>
</span><span id="line-1583"></span><span id="local-6989586621679185411"><span id="local-6989586621679185412"><span class="annot"><a href="Data.Map.Strict.Internal.html#fromAscList"><span class="hs-identifier hs-type">fromAscList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Eq</span></span><span> </span><span class="annot"><a href="#local-6989586621679185412"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185412"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679185411"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185412"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185411"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-1584"></span><span id="fromAscList"><span class="annot"><span class="annottext">fromAscList :: forall k a. Eq k =&gt; [(k, a)] -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#fromAscList"><span class="hs-identifier hs-var hs-var">fromAscList</span></a></span></span><span> </span><span id="local-6989586621679184391"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184391"><span class="hs-identifier hs-var">xs</span></a></span></span><span>
</span><span id="line-1585"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; a -&gt; a -&gt; a) -&gt; [(k, a)] -&gt; Map k a
forall k a. Eq k =&gt; (k -&gt; a -&gt; a -&gt; a) -&gt; [(k, a)] -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#fromAscListWithKey"><span class="hs-identifier hs-var">fromAscListWithKey</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">k
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184390"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184390"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184390"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184391"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#fromAscList"><span class="hs-pragma hs-type">fromAscList</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1590"></span><span class="hs-comment">-- | /O(n)/. Build a map from a descending list in linear time.</span><span>
</span><span id="line-1591"></span><span class="hs-comment">-- /The precondition (input list is descending) is not checked./</span><span>
</span><span id="line-1592"></span><span class="hs-comment">--</span><span>
</span><span id="line-1593"></span><span class="hs-comment">-- &gt; fromDescList [(5,&quot;a&quot;), (3,&quot;b&quot;)]          == fromList [(3, &quot;b&quot;), (5, &quot;a&quot;)]</span><span>
</span><span id="line-1594"></span><span class="hs-comment">-- &gt; fromDescList [(5,&quot;a&quot;), (5,&quot;b&quot;), (3,&quot;a&quot;)] == fromList [(3, &quot;b&quot;), (5, &quot;b&quot;)]</span><span>
</span><span id="line-1595"></span><span class="hs-comment">-- &gt; valid (fromDescList [(5,&quot;a&quot;), (5,&quot;b&quot;), (3,&quot;b&quot;)]) == True</span><span>
</span><span id="line-1596"></span><span class="hs-comment">-- &gt; valid (fromDescList [(5,&quot;a&quot;), (3,&quot;b&quot;), (5,&quot;b&quot;)]) == False</span><span>
</span><span id="line-1597"></span><span id="local-6989586621679184388"><span id="local-6989586621679184389"><span class="annot"><a href="Data.Map.Strict.Internal.html#fromDescList"><span class="hs-identifier hs-type">fromDescList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Eq</span></span><span> </span><span class="annot"><a href="#local-6989586621679184389"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679184389"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679184388"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184389"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184388"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-1598"></span><span id="fromDescList"><span class="annot"><span class="annottext">fromDescList :: forall k a. Eq k =&gt; [(k, a)] -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#fromDescList"><span class="hs-identifier hs-var hs-var">fromDescList</span></a></span></span><span> </span><span id="local-6989586621679184385"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184385"><span class="hs-identifier hs-var">xs</span></a></span></span><span>
</span><span id="line-1599"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; a -&gt; a -&gt; a) -&gt; [(k, a)] -&gt; Map k a
forall k a. Eq k =&gt; (k -&gt; a -&gt; a -&gt; a) -&gt; [(k, a)] -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#fromDescListWithKey"><span class="hs-identifier hs-var">fromDescListWithKey</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">k
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184384"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184384"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184384"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184385"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#fromDescList"><span class="hs-pragma hs-type">fromDescList</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1604"></span><span class="hs-comment">-- | /O(n)/. Build a map from an ascending list in linear time with a combining function for equal keys.</span><span>
</span><span id="line-1605"></span><span class="hs-comment">-- /The precondition (input list is ascending) is not checked./</span><span>
</span><span id="line-1606"></span><span class="hs-comment">--</span><span>
</span><span id="line-1607"></span><span class="hs-comment">-- &gt; fromAscListWith (++) [(3,&quot;b&quot;), (5,&quot;a&quot;), (5,&quot;b&quot;)] == fromList [(3, &quot;b&quot;), (5, &quot;ba&quot;)]</span><span>
</span><span id="line-1608"></span><span class="hs-comment">-- &gt; valid (fromAscListWith (++) [(3,&quot;b&quot;), (5,&quot;a&quot;), (5,&quot;b&quot;)]) == True</span><span>
</span><span id="line-1609"></span><span class="hs-comment">-- &gt; valid (fromAscListWith (++) [(5,&quot;a&quot;), (3,&quot;b&quot;), (5,&quot;b&quot;)]) == False</span><span>
</span><span id="line-1610"></span><span>
</span><span id="line-1611"></span><span id="local-6989586621679185403"><span id="local-6989586621679185404"><span class="annot"><a href="Data.Map.Strict.Internal.html#fromAscListWith"><span class="hs-identifier hs-type">fromAscListWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Eq</span></span><span> </span><span class="annot"><a href="#local-6989586621679185404"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185403"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185403"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185403"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185404"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679185403"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185404"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185403"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-1612"></span><span id="fromAscListWith"><span class="annot"><span class="annottext">fromAscListWith :: forall k a. Eq k =&gt; (a -&gt; a -&gt; a) -&gt; [(k, a)] -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#fromAscListWith"><span class="hs-identifier hs-var hs-var">fromAscListWith</span></a></span></span><span> </span><span id="local-6989586621679184381"><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679184381"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184380"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184380"><span class="hs-identifier hs-var">xs</span></a></span></span><span>
</span><span id="line-1613"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; a -&gt; a -&gt; a) -&gt; [(k, a)] -&gt; Map k a
forall k a. Eq k =&gt; (k -&gt; a -&gt; a -&gt; a) -&gt; [(k, a)] -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#fromAscListWithKey"><span class="hs-identifier hs-var">fromAscListWithKey</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">k
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184379"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184379"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679184378"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184378"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679184381"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184379"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184378"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184380"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#fromAscListWith"><span class="hs-pragma hs-type">fromAscListWith</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1618"></span><span class="hs-comment">-- | /O(n)/. Build a map from a descending list in linear time with a combining function for equal keys.</span><span>
</span><span id="line-1619"></span><span class="hs-comment">-- /The precondition (input list is descending) is not checked./</span><span>
</span><span id="line-1620"></span><span class="hs-comment">--</span><span>
</span><span id="line-1621"></span><span class="hs-comment">-- &gt; fromDescListWith (++) [(5,&quot;a&quot;), (5,&quot;b&quot;), (3,&quot;b&quot;)] == fromList [(3, &quot;b&quot;), (5, &quot;ba&quot;)]</span><span>
</span><span id="line-1622"></span><span class="hs-comment">-- &gt; valid (fromDescListWith (++) [(5,&quot;a&quot;), (5,&quot;b&quot;), (3,&quot;b&quot;)]) == True</span><span>
</span><span id="line-1623"></span><span class="hs-comment">-- &gt; valid (fromDescListWith (++) [(5,&quot;a&quot;), (3,&quot;b&quot;), (5,&quot;b&quot;)]) == False</span><span>
</span><span id="line-1624"></span><span>
</span><span id="line-1625"></span><span id="local-6989586621679184376"><span id="local-6989586621679184377"><span class="annot"><a href="Data.Map.Strict.Internal.html#fromDescListWith"><span class="hs-identifier hs-type">fromDescListWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Eq</span></span><span> </span><span class="annot"><a href="#local-6989586621679184377"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679184376"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679184376"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679184376"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679184377"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679184376"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184377"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184376"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-1626"></span><span id="fromDescListWith"><span class="annot"><span class="annottext">fromDescListWith :: forall k a. Eq k =&gt; (a -&gt; a -&gt; a) -&gt; [(k, a)] -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#fromDescListWith"><span class="hs-identifier hs-var hs-var">fromDescListWith</span></a></span></span><span> </span><span id="local-6989586621679184373"><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679184373"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184372"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184372"><span class="hs-identifier hs-var">xs</span></a></span></span><span>
</span><span id="line-1627"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k -&gt; a -&gt; a -&gt; a) -&gt; [(k, a)] -&gt; Map k a
forall k a. Eq k =&gt; (k -&gt; a -&gt; a -&gt; a) -&gt; [(k, a)] -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#fromDescListWithKey"><span class="hs-identifier hs-var">fromDescListWithKey</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">k
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184371"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184371"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679184370"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184370"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679184373"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184371"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184370"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184372"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#fromDescListWith"><span class="hs-pragma hs-type">fromDescListWith</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1632"></span><span class="hs-comment">-- | /O(n)/. Build a map from an ascending list in linear time with a</span><span>
</span><span id="line-1633"></span><span class="hs-comment">-- combining function for equal keys.</span><span>
</span><span id="line-1634"></span><span class="hs-comment">-- /The precondition (input list is ascending) is not checked./</span><span>
</span><span id="line-1635"></span><span class="hs-comment">--</span><span>
</span><span id="line-1636"></span><span class="hs-comment">-- &gt; let f k a1 a2 = (show k) ++ &quot;:&quot; ++ a1 ++ a2</span><span>
</span><span id="line-1637"></span><span class="hs-comment">-- &gt; fromAscListWithKey f [(3,&quot;b&quot;), (5,&quot;a&quot;), (5,&quot;b&quot;), (5,&quot;b&quot;)] == fromList [(3, &quot;b&quot;), (5, &quot;5:b5:ba&quot;)]</span><span>
</span><span id="line-1638"></span><span class="hs-comment">-- &gt; valid (fromAscListWithKey f [(3,&quot;b&quot;), (5,&quot;a&quot;), (5,&quot;b&quot;), (5,&quot;b&quot;)]) == True</span><span>
</span><span id="line-1639"></span><span class="hs-comment">-- &gt; valid (fromAscListWithKey f [(5,&quot;a&quot;), (3,&quot;b&quot;), (5,&quot;b&quot;), (5,&quot;b&quot;)]) == False</span><span>
</span><span id="line-1640"></span><span>
</span><span id="line-1641"></span><span id="local-6989586621679185407"><span id="local-6989586621679185408"><span class="annot"><a href="Data.Map.Strict.Internal.html#fromAscListWithKey"><span class="hs-identifier hs-type">fromAscListWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Eq</span></span><span> </span><span class="annot"><a href="#local-6989586621679185408"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185408"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185407"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185407"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679185407"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185408"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679185407"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185408"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185407"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-1642"></span><span id="fromAscListWithKey"><span class="annot"><span class="annottext">fromAscListWithKey :: forall k a. Eq k =&gt; (k -&gt; a -&gt; a -&gt; a) -&gt; [(k, a)] -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#fromAscListWithKey"><span class="hs-identifier hs-var hs-var">fromAscListWithKey</span></a></span></span><span> </span><span id="local-6989586621679184368"><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679184368"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184367"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184367"><span class="hs-identifier hs-var">xs</span></a></span></span><span>
</span><span id="line-1643"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(k, a)] -&gt; Map k a
forall k a. [(k, a)] -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#fromDistinctAscList"><span class="hs-identifier hs-var">fromDistinctAscList</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(k -&gt; a -&gt; a -&gt; a) -&gt; [(k, a)] -&gt; [(k, a)]
forall {p}. p -&gt; [(k, a)] -&gt; [(k, a)]
</span><a href="#local-6989586621679184366"><span class="hs-identifier hs-var">combineEq</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679184368"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184367"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1644"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1645"></span><span>  </span><span class="hs-comment">-- [combineEq f xs] combines equal elements with function [f] in an ordered list [xs]</span><span>
</span><span id="line-1646"></span><span>  </span><span id="local-6989586621679184366"><span class="annot"><span class="annottext">combineEq :: p -&gt; [(k, a)] -&gt; [(k, a)]
</span><a href="#local-6989586621679184366"><span class="hs-identifier hs-var hs-var">combineEq</span></a></span></span><span> </span><span class="annot"><span class="annottext">p
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184365"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184365"><span class="hs-identifier hs-var">xs'</span></a></span></span><span>
</span><span id="line-1647"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184365"><span class="hs-identifier hs-var">xs'</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1648"></span><span>        </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1649"></span><span>        </span><span class="hs-special">[</span><span id="local-6989586621679184364"><span class="annot"><span class="annottext">(k, a)
</span><a href="#local-6989586621679184364"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">]</span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">(k, a)
</span><a href="#local-6989586621679184364"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1650"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621679184363"><span class="annot"><span class="annottext">(k, a)
</span><a href="#local-6989586621679184363"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679184362"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184362"><span class="hs-identifier hs-var">xx</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(k, a) -&gt; [(k, a)] -&gt; [(k, a)]
</span><a href="#local-6989586621679184361"><span class="hs-identifier hs-var">combineEq'</span></a></span><span> </span><span class="annot"><span class="annottext">(k, a)
</span><a href="#local-6989586621679184363"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184362"><span class="hs-identifier hs-var">xx</span></a></span><span>
</span><span id="line-1651"></span><span>
</span><span id="line-1652"></span><span>  </span><span id="local-6989586621679184361"><span class="annot"><span class="annottext">combineEq' :: (k, a) -&gt; [(k, a)] -&gt; [(k, a)]
</span><a href="#local-6989586621679184361"><span class="hs-identifier hs-var hs-var">combineEq'</span></a></span></span><span> </span><span id="local-6989586621679184359"><span class="annot"><span class="annottext">(k, a)
</span><a href="#local-6989586621679184359"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">(k, a)
</span><a href="#local-6989586621679184359"><span class="hs-identifier hs-var">z</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1653"></span><span>  </span><span class="annot"><a href="#local-6989586621679184361"><span class="hs-identifier hs-var">combineEq'</span></a></span><span> </span><span id="local-6989586621679184358"><span class="annot"><span class="annottext">z :: (k, a)
</span><a href="#local-6989586621679184358"><span class="hs-identifier hs-var">z</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621679184357"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184357"><span class="hs-identifier hs-var">kz</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679184356"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184356"><span class="hs-identifier hs-var">zz</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679184355"><span class="annot"><span class="annottext">x :: (k, a)
</span><a href="#local-6989586621679184355"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621679184354"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184354"><span class="hs-identifier hs-var">kx</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679184353"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184353"><span class="hs-identifier hs-var">xx</span></a></span></span><span class="hs-special">)</span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679184352"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184352"><span class="hs-identifier hs-var">xs'</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1654"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184354"><span class="hs-identifier hs-var">kx</span></a></span><span class="annot"><span class="annottext">k -&gt; k -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184357"><span class="hs-identifier hs-var">kz</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679184351"><span class="annot"><span class="annottext">yy :: a
</span><a href="#local-6989586621679184351"><span class="hs-identifier hs-var hs-var">yy</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679184368"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184354"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184353"><span class="hs-identifier hs-var">xx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184356"><span class="hs-identifier hs-var">zz</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184351"><span class="hs-identifier hs-var">yy</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [(k, a)] -&gt; [(k, a)]
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">(k, a) -&gt; [(k, a)] -&gt; [(k, a)]
</span><a href="#local-6989586621679184361"><span class="hs-identifier hs-var">combineEq'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184354"><span class="hs-identifier hs-var">kx</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184351"><span class="hs-identifier hs-var">yy</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184352"><span class="hs-identifier hs-var">xs'</span></a></span><span>
</span><span id="line-1655"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k, a)
</span><a href="#local-6989586621679184358"><span class="hs-identifier hs-var">z</span></a></span><span class="annot"><span class="annottext">(k, a) -&gt; [(k, a)] -&gt; [(k, a)]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">(k, a) -&gt; [(k, a)] -&gt; [(k, a)]
</span><a href="#local-6989586621679184361"><span class="hs-identifier hs-var">combineEq'</span></a></span><span> </span><span class="annot"><span class="annottext">(k, a)
</span><a href="#local-6989586621679184355"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184352"><span class="hs-identifier hs-var">xs'</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#fromAscListWithKey"><span class="hs-pragma hs-type">fromAscListWithKey</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1660"></span><span class="hs-comment">-- | /O(n)/. Build a map from a descending list in linear time with a</span><span>
</span><span id="line-1661"></span><span class="hs-comment">-- combining function for equal keys.</span><span>
</span><span id="line-1662"></span><span class="hs-comment">-- /The precondition (input list is descending) is not checked./</span><span>
</span><span id="line-1663"></span><span class="hs-comment">--</span><span>
</span><span id="line-1664"></span><span class="hs-comment">-- &gt; let f k a1 a2 = (show k) ++ &quot;:&quot; ++ a1 ++ a2</span><span>
</span><span id="line-1665"></span><span class="hs-comment">-- &gt; fromDescListWithKey f [(5,&quot;a&quot;), (5,&quot;b&quot;), (5,&quot;b&quot;), (3,&quot;b&quot;)] == fromList [(3, &quot;b&quot;), (5, &quot;5:b5:ba&quot;)]</span><span>
</span><span id="line-1666"></span><span class="hs-comment">-- &gt; valid (fromDescListWithKey f [(5,&quot;a&quot;), (5,&quot;b&quot;), (5,&quot;b&quot;), (3,&quot;b&quot;)]) == True</span><span>
</span><span id="line-1667"></span><span class="hs-comment">-- &gt; valid (fromDescListWithKey f [(5,&quot;a&quot;), (3,&quot;b&quot;), (5,&quot;b&quot;), (5,&quot;b&quot;)]) == False</span><span>
</span><span id="line-1668"></span><span>
</span><span id="line-1669"></span><span id="local-6989586621679184349"><span id="local-6989586621679184350"><span class="annot"><a href="Data.Map.Strict.Internal.html#fromDescListWithKey"><span class="hs-identifier hs-type">fromDescListWithKey</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Eq</span></span><span> </span><span class="annot"><a href="#local-6989586621679184350"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679184350"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679184349"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679184349"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679184349"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679184350"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679184349"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184350"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184349"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-1670"></span><span id="fromDescListWithKey"><span class="annot"><span class="annottext">fromDescListWithKey :: forall k a. Eq k =&gt; (k -&gt; a -&gt; a -&gt; a) -&gt; [(k, a)] -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#fromDescListWithKey"><span class="hs-identifier hs-var hs-var">fromDescListWithKey</span></a></span></span><span> </span><span id="local-6989586621679184347"><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679184347"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679184346"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184346"><span class="hs-identifier hs-var">xs</span></a></span></span><span>
</span><span id="line-1671"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(k, a)] -&gt; Map k a
forall k a. [(k, a)] -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#fromDistinctDescList"><span class="hs-identifier hs-var">fromDistinctDescList</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(k -&gt; a -&gt; a -&gt; a) -&gt; [(k, a)] -&gt; [(k, a)]
forall {p}. p -&gt; [(k, a)] -&gt; [(k, a)]
</span><a href="#local-6989586621679184345"><span class="hs-identifier hs-var">combineEq</span></a></span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679184347"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184346"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1672"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1673"></span><span>  </span><span class="hs-comment">-- [combineEq f xs] combines equal elements with function [f] in an ordered list [xs]</span><span>
</span><span id="line-1674"></span><span>  </span><span id="local-6989586621679184345"><span class="annot"><span class="annottext">combineEq :: p -&gt; [(k, a)] -&gt; [(k, a)]
</span><a href="#local-6989586621679184345"><span class="hs-identifier hs-var hs-var">combineEq</span></a></span></span><span> </span><span class="annot"><span class="annottext">p
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184344"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184344"><span class="hs-identifier hs-var">xs'</span></a></span></span><span>
</span><span id="line-1675"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184344"><span class="hs-identifier hs-var">xs'</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1676"></span><span>        </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1677"></span><span>        </span><span class="hs-special">[</span><span id="local-6989586621679184343"><span class="annot"><span class="annottext">(k, a)
</span><a href="#local-6989586621679184343"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">]</span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">(k, a)
</span><a href="#local-6989586621679184343"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1678"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621679184342"><span class="annot"><span class="annottext">(k, a)
</span><a href="#local-6989586621679184342"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679184341"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184341"><span class="hs-identifier hs-var">xx</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(k, a) -&gt; [(k, a)] -&gt; [(k, a)]
</span><a href="#local-6989586621679184340"><span class="hs-identifier hs-var">combineEq'</span></a></span><span> </span><span class="annot"><span class="annottext">(k, a)
</span><a href="#local-6989586621679184342"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184341"><span class="hs-identifier hs-var">xx</span></a></span><span>
</span><span id="line-1679"></span><span>
</span><span id="line-1680"></span><span>  </span><span id="local-6989586621679184340"><span class="annot"><span class="annottext">combineEq' :: (k, a) -&gt; [(k, a)] -&gt; [(k, a)]
</span><a href="#local-6989586621679184340"><span class="hs-identifier hs-var hs-var">combineEq'</span></a></span></span><span> </span><span id="local-6989586621679184338"><span class="annot"><span class="annottext">(k, a)
</span><a href="#local-6989586621679184338"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">(k, a)
</span><a href="#local-6989586621679184338"><span class="hs-identifier hs-var">z</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1681"></span><span>  </span><span class="annot"><a href="#local-6989586621679184340"><span class="hs-identifier hs-var">combineEq'</span></a></span><span> </span><span id="local-6989586621679184337"><span class="annot"><span class="annottext">z :: (k, a)
</span><a href="#local-6989586621679184337"><span class="hs-identifier hs-var">z</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621679184336"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184336"><span class="hs-identifier hs-var">kz</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679184335"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184335"><span class="hs-identifier hs-var">zz</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679184334"><span class="annot"><span class="annottext">x :: (k, a)
</span><a href="#local-6989586621679184334"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621679184333"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184333"><span class="hs-identifier hs-var">kx</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679184332"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184332"><span class="hs-identifier hs-var">xx</span></a></span></span><span class="hs-special">)</span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679184331"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184331"><span class="hs-identifier hs-var">xs'</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1682"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184333"><span class="hs-identifier hs-var">kx</span></a></span><span class="annot"><span class="annottext">k -&gt; k -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184336"><span class="hs-identifier hs-var">kz</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679184330"><span class="annot"><span class="annottext">yy :: a
</span><a href="#local-6989586621679184330"><span class="hs-identifier hs-var hs-var">yy</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; a -&gt; a
</span><a href="#local-6989586621679184347"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184333"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184332"><span class="hs-identifier hs-var">xx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184335"><span class="hs-identifier hs-var">zz</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184330"><span class="hs-identifier hs-var">yy</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [(k, a)] -&gt; [(k, a)]
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">(k, a) -&gt; [(k, a)] -&gt; [(k, a)]
</span><a href="#local-6989586621679184340"><span class="hs-identifier hs-var">combineEq'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184333"><span class="hs-identifier hs-var">kx</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184330"><span class="hs-identifier hs-var">yy</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184331"><span class="hs-identifier hs-var">xs'</span></a></span><span>
</span><span id="line-1683"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(k, a)
</span><a href="#local-6989586621679184337"><span class="hs-identifier hs-var">z</span></a></span><span class="annot"><span class="annottext">(k, a) -&gt; [(k, a)] -&gt; [(k, a)]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">(k, a) -&gt; [(k, a)] -&gt; [(k, a)]
</span><a href="#local-6989586621679184340"><span class="hs-identifier hs-var">combineEq'</span></a></span><span> </span><span class="annot"><span class="annottext">(k, a)
</span><a href="#local-6989586621679184334"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184331"><span class="hs-identifier hs-var">xs'</span></a></span><span class="hs-cpp">
#if __GLASGOW_HASKELL__
</span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="Data.Map.Strict.Internal.html#fromDescListWithKey"><span class="hs-pragma hs-type">fromDescListWithKey</span></a></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1688"></span><span class="hs-comment">-- | /O(n)/. Build a map from an ascending list of distinct elements in linear time.</span><span>
</span><span id="line-1689"></span><span class="hs-comment">-- /The precondition is not checked./</span><span>
</span><span id="line-1690"></span><span class="hs-comment">--</span><span>
</span><span id="line-1691"></span><span class="hs-comment">-- &gt; fromDistinctAscList [(3,&quot;b&quot;), (5,&quot;a&quot;)] == fromList [(3, &quot;b&quot;), (5, &quot;a&quot;)]</span><span>
</span><span id="line-1692"></span><span class="hs-comment">-- &gt; valid (fromDistinctAscList [(3,&quot;b&quot;), (5,&quot;a&quot;)])          == True</span><span>
</span><span id="line-1693"></span><span class="hs-comment">-- &gt; valid (fromDistinctAscList [(3,&quot;b&quot;), (5,&quot;a&quot;), (5,&quot;b&quot;)]) == False</span><span>
</span><span id="line-1694"></span><span>
</span><span id="line-1695"></span><span class="hs-comment">-- For some reason, when 'singleton' is used in fromDistinctAscList or in</span><span>
</span><span id="line-1696"></span><span class="hs-comment">-- create, it is not inlined, so we inline it manually.</span><span>
</span><span id="line-1697"></span><span id="local-6989586621679185395"><span id="local-6989586621679185396"><span class="annot"><a href="Data.Map.Strict.Internal.html#fromDistinctAscList"><span class="hs-identifier hs-type">fromDistinctAscList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679185396"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679185395"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185396"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679185395"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-1698"></span><span id="fromDistinctAscList"><span class="annot"><span class="annottext">fromDistinctAscList :: forall k a. [(k, a)] -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#fromDistinctAscList"><span class="hs-identifier hs-var hs-var">fromDistinctAscList</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1699"></span><span class="annot"><a href="Data.Map.Strict.Internal.html#fromDistinctAscList"><span class="hs-identifier hs-var">fromDistinctAscList</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621679184327"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184327"><span class="hs-identifier hs-var">kx0</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184326"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184326"><span class="hs-identifier hs-var">x0</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679184325"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184325"><span class="hs-identifier hs-var">xs0</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184326"><span class="hs-identifier hs-var">x0</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Map k a -&gt; Map k a
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">Size -&gt; Map k a -&gt; [(k, a)] -&gt; Map k a
forall {t} {k} {a}.
(Num t, Bits t) =&gt;
t -&gt; Map k a -&gt; [(k, a)] -&gt; Map k a
</span><a href="#local-6989586621679184324"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Size
</span><span class="hs-number">1</span></span><span class="hs-glyph">::</span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184327"><span class="hs-identifier hs-var">kx0</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184326"><span class="hs-identifier hs-var">x0</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184325"><span class="hs-identifier hs-var">xs0</span></a></span><span>
</span><span id="line-1700"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1701"></span><span>    </span><span id="local-6989586621679184324"><span class="annot"><span class="annottext">go :: t -&gt; Map k a -&gt; [(k, a)] -&gt; Map k a
</span><a href="#local-6989586621679184324"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">t
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184318"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184318"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184318"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1702"></span><span>    </span><span class="annot"><a href="#local-6989586621679184324"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679184317"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679184317"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679184316"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184316"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621679184315"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184315"><span class="hs-identifier hs-var">kx</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184314"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184314"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679184313"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184313"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1703"></span><span>      </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">t -&gt; [(k, a)] -&gt; StrictPair (Map k a) [(k, a)]
forall {a} {k} {a}.
(Num a, Bits a) =&gt;
a -&gt; [(k, a)] -&gt; StrictPair (Map k a) [(k, a)]
</span><a href="#local-6989586621679184312"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679184317"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184313"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1704"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621679184311"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184311"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679184310"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184310"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184314"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Map k a -&gt; Map k a
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679184309"><span class="annot"><span class="annottext">t' :: Map k a
</span><a href="#local-6989586621679184309"><span class="hs-identifier hs-var hs-var">t'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184315"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184314"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184316"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184311"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1705"></span><span>                           </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">t -&gt; Map k a -&gt; [(k, a)] -&gt; Map k a
</span><a href="#local-6989586621679184324"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679184317"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">t -&gt; Size -&gt; t
forall a. Bits a =&gt; a -&gt; Size -&gt; a
</span><a href="../../base/src/Data.Bits.html#shiftL"><span class="hs-operator hs-var">`shiftL`</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184309"><span class="hs-identifier hs-var">t'</span></a></span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184310"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-1706"></span><span>
</span><span id="line-1707"></span><span>    </span><span id="local-6989586621679184312"><span class="annot"><span class="annottext">create :: a -&gt; [(k, a)] -&gt; StrictPair (Map k a) [(k, a)]
</span><a href="#local-6989586621679184312"><span class="hs-identifier hs-var hs-var">create</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; [(k, a)] -&gt; StrictPair (Map k a) [(k, a)]
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1708"></span><span>    </span><span class="annot"><a href="#local-6989586621679184312"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span id="local-6989586621679184301"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184301"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679184300"><span class="annot"><span class="annottext">xs :: [(k, a)]
</span><a href="#local-6989586621679184300"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621679184299"><span class="annot"><span class="annottext">(k, a)
</span><a href="#local-6989586621679184299"><span class="hs-identifier hs-var">x'</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679184298"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184298"><span class="hs-identifier hs-var">xs'</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1709"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184301"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">1</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">(k, a)
</span><a href="#local-6989586621679184299"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="hs-keyword">of</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679184297"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184297"><span class="hs-identifier hs-var">kx</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184296"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184296"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184296"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; StrictPair (Map k a) [(k, a)] -&gt; StrictPair (Map k a) [(k, a)]
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184297"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184296"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; [(k, a)] -&gt; StrictPair (Map k a) [(k, a)]
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184298"><span class="hs-identifier hs-var">xs'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1710"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; [(k, a)] -&gt; StrictPair (Map k a) [(k, a)]
</span><a href="#local-6989586621679184312"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184301"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Size -&gt; a
forall a. Bits a =&gt; a -&gt; Size -&gt; a
</span><a href="../../base/src/Data.Bits.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184300"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1711"></span><span>                      </span><span id="local-6989586621679184295"><span class="annot"><span class="annottext">res :: StrictPair (Map k a) [(k, a)]
</span><a href="#local-6989586621679184295"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Map k a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">StrictPair (Map k a) [(k, a)]
</span><a href="#local-6989586621679184295"><span class="hs-identifier hs-var">res</span></a></span><span>
</span><span id="line-1712"></span><span>                      </span><span class="hs-special">(</span><span id="local-6989586621679184294"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184294"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679184293"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184293"><span class="hs-identifier hs-var">ky</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184292"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184292"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679184291"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184291"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; [(k, a)] -&gt; StrictPair (Map k a) [(k, a)]
</span><a href="#local-6989586621679184312"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184301"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Size -&gt; a
forall a. Bits a =&gt; a -&gt; Size -&gt; a
</span><a href="../../base/src/Data.Bits.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184291"><span class="hs-identifier hs-var">ys</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1713"></span><span>                        </span><span class="hs-special">(</span><span id="local-6989586621679184290"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184290"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679184289"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184289"><span class="hs-identifier hs-var">zs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184292"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; StrictPair (Map k a) [(k, a)] -&gt; StrictPair (Map k a) [(k, a)]
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184293"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184292"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184294"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184290"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; [(k, a)] -&gt; StrictPair (Map k a) [(k, a)]
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184289"><span class="hs-identifier hs-var">zs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1714"></span><span>
</span><span id="line-1715"></span><span class="hs-comment">-- | /O(n)/. Build a map from a descending list of distinct elements in linear time.</span><span>
</span><span id="line-1716"></span><span class="hs-comment">-- /The precondition is not checked./</span><span>
</span><span id="line-1717"></span><span class="hs-comment">--</span><span>
</span><span id="line-1718"></span><span class="hs-comment">-- &gt; fromDistinctDescList [(5,&quot;a&quot;), (3,&quot;b&quot;)] == fromList [(3, &quot;b&quot;), (5, &quot;a&quot;)]</span><span>
</span><span id="line-1719"></span><span class="hs-comment">-- &gt; valid (fromDistinctDescList [(5,&quot;a&quot;), (3,&quot;b&quot;)])          == True</span><span>
</span><span id="line-1720"></span><span class="hs-comment">-- &gt; valid (fromDistinctDescList [(5,&quot;a&quot;), (3,&quot;b&quot;), (3,&quot;a&quot;)]) == False</span><span>
</span><span id="line-1721"></span><span>
</span><span id="line-1722"></span><span class="hs-comment">-- For some reason, when 'singleton' is used in fromDistinctDescList or in</span><span>
</span><span id="line-1723"></span><span class="hs-comment">-- create, it is not inlined, so we inline it manually.</span><span>
</span><span id="line-1724"></span><span id="local-6989586621679184287"><span id="local-6989586621679184288"><span class="annot"><a href="Data.Map.Strict.Internal.html#fromDistinctDescList"><span class="hs-identifier hs-type">fromDistinctDescList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679184288"><span class="hs-identifier hs-type">k</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679184287"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Map.Internal.html#Map"><span class="hs-identifier hs-type">Map</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184288"><span class="hs-identifier hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679184287"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-1725"></span><span id="fromDistinctDescList"><span class="annot"><span class="annottext">fromDistinctDescList :: forall k a. [(k, a)] -&gt; Map k a
</span><a href="Data.Map.Strict.Internal.html#fromDistinctDescList"><span class="hs-identifier hs-var hs-var">fromDistinctDescList</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span>
</span><span id="line-1726"></span><span class="annot"><a href="Data.Map.Strict.Internal.html#fromDistinctDescList"><span class="hs-identifier hs-var">fromDistinctDescList</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621679184284"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184284"><span class="hs-identifier hs-var">kx0</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184283"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184283"><span class="hs-identifier hs-var">x0</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679184282"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184282"><span class="hs-identifier hs-var">xs0</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184283"><span class="hs-identifier hs-var">x0</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Map k a -&gt; Map k a
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">Size -&gt; Map k a -&gt; [(k, a)] -&gt; Map k a
forall {t} {k} {a}.
(Num t, Bits t) =&gt;
t -&gt; Map k a -&gt; [(k, a)] -&gt; Map k a
</span><a href="#local-6989586621679184281"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Size
</span><span class="hs-number">1</span></span><span class="hs-glyph">::</span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184284"><span class="hs-identifier hs-var">kx0</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184283"><span class="hs-identifier hs-var">x0</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184282"><span class="hs-identifier hs-var">xs0</span></a></span><span>
</span><span id="line-1727"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1728"></span><span>    </span><span id="local-6989586621679184281"><span class="annot"><span class="annottext">go :: t -&gt; Map k a -&gt; [(k, a)] -&gt; Map k a
</span><a href="#local-6989586621679184281"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">t
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679184275"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184275"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184275"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1729"></span><span>    </span><span class="annot"><a href="#local-6989586621679184281"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679184274"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679184274"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679184273"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184273"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621679184272"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184272"><span class="hs-identifier hs-var">kx</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184271"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184271"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679184270"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184270"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1730"></span><span>      </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">t -&gt; [(k, a)] -&gt; StrictPair (Map k a) [(k, a)]
forall {a} {k} {a}.
(Num a, Bits a) =&gt;
a -&gt; [(k, a)] -&gt; StrictPair (Map k a) [(k, a)]
</span><a href="#local-6989586621679184269"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679184274"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184270"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1731"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621679184268"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184268"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679184267"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184267"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184271"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Map k a -&gt; Map k a
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679184266"><span class="annot"><span class="annottext">t' :: Map k a
</span><a href="#local-6989586621679184266"><span class="hs-identifier hs-var hs-var">t'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184272"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184271"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184268"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184273"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1732"></span><span>                              </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">t -&gt; Map k a -&gt; [(k, a)] -&gt; Map k a
</span><a href="#local-6989586621679184281"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679184274"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">t -&gt; Size -&gt; t
forall a. Bits a =&gt; a -&gt; Size -&gt; a
</span><a href="../../base/src/Data.Bits.html#shiftL"><span class="hs-operator hs-var">`shiftL`</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184266"><span class="hs-identifier hs-var">t'</span></a></span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184267"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-1733"></span><span>
</span><span id="line-1734"></span><span>    </span><span id="local-6989586621679184269"><span class="annot"><span class="annottext">create :: a -&gt; [(k, a)] -&gt; StrictPair (Map k a) [(k, a)]
</span><a href="#local-6989586621679184269"><span class="hs-identifier hs-var hs-var">create</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; [(k, a)] -&gt; StrictPair (Map k a) [(k, a)]
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1735"></span><span>    </span><span class="annot"><a href="#local-6989586621679184269"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span id="local-6989586621679184258"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184258"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679184257"><span class="annot"><span class="annottext">xs :: [(k, a)]
</span><a href="#local-6989586621679184257"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621679184256"><span class="annot"><span class="annottext">(k, a)
</span><a href="#local-6989586621679184256"><span class="hs-identifier hs-var">x'</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679184255"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184255"><span class="hs-identifier hs-var">xs'</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1736"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184258"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">1</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">(k, a)
</span><a href="#local-6989586621679184256"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="hs-keyword">of</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679184254"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184254"><span class="hs-identifier hs-var">kx</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184253"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184253"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184253"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; StrictPair (Map k a) [(k, a)] -&gt; StrictPair (Map k a) [(k, a)]
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. Size -&gt; k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#Bin"><span class="hs-identifier hs-var">Bin</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184254"><span class="hs-identifier hs-var">kx</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184253"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
forall k a. Map k a
</span><a href="Data.Map.Internal.html#Tip"><span class="hs-identifier hs-var">Tip</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; [(k, a)] -&gt; StrictPair (Map k a) [(k, a)]
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184255"><span class="hs-identifier hs-var">xs'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1737"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; [(k, a)] -&gt; StrictPair (Map k a) [(k, a)]
</span><a href="#local-6989586621679184269"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184258"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Size -&gt; a
forall a. Bits a =&gt; a -&gt; Size -&gt; a
</span><a href="../../base/src/Data.Bits.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184257"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1738"></span><span>                      </span><span id="local-6989586621679184252"><span class="annot"><span class="annottext">res :: StrictPair (Map k a) [(k, a)]
</span><a href="#local-6989586621679184252"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Map k a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">StrictPair (Map k a) [(k, a)]
</span><a href="#local-6989586621679184252"><span class="hs-identifier hs-var">res</span></a></span><span>
</span><span id="line-1739"></span><span>                      </span><span class="hs-special">(</span><span id="local-6989586621679184251"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184251"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679184250"><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184250"><span class="hs-identifier hs-var">ky</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679184249"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184249"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621679184248"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184248"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; [(k, a)] -&gt; StrictPair (Map k a) [(k, a)]
</span><a href="#local-6989586621679184269"><span class="hs-identifier hs-var">create</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184258"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Size -&gt; a
forall a. Bits a =&gt; a -&gt; Size -&gt; a
</span><a href="../../base/src/Data.Bits.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="annot"><span class="annottext">Size
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184248"><span class="hs-identifier hs-var">ys</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1740"></span><span>                        </span><span class="hs-special">(</span><span id="local-6989586621679184247"><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184247"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="annot"><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621679184246"><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184246"><span class="hs-identifier hs-var">zs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184249"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; StrictPair (Map k a) [(k, a)] -&gt; StrictPair (Map k a) [(k, a)]
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
forall k a. k -&gt; a -&gt; Map k a -&gt; Map k a -&gt; Map k a
</span><a href="Data.Map.Internal.html#link"><span class="hs-identifier hs-var">link</span></a></span><span> </span><span class="annot"><span class="annottext">k
</span><a href="#local-6989586621679184250"><span class="hs-identifier hs-var">ky</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679184249"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184247"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a
</span><a href="#local-6989586621679184251"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Map k a -&gt; [(k, a)] -&gt; StrictPair (Map k a) [(k, a)]
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="Utils.Containers.Internal.StrictPair.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">[(k, a)]
</span><a href="#local-6989586621679184246"><span class="hs-identifier hs-var">zs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1741"></span></pre></body></html>